aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@fury.ukcod.org.uk>2011-02-14 15:40:34 +0000
committerMatthew Somerville <matthew@fury.ukcod.org.uk>2011-02-14 15:40:34 +0000
commit91ac9486a1fd2eeb65fc9c6d2fccc1b170cfc16f (patch)
tree2d0ddea3e0f8a870ebe910c51aa2d0807f50eeb8
parent844b21d06083368048a0ea2c20baffc7d06b0449 (diff)
Tweaks to OSM map module, fix for truncated co-ords.
-rw-r--r--perllib/FixMyStreet/Map/OSM.pm7
-rw-r--r--perllib/Page.pm2
-rw-r--r--perllib/Utils.pm4
-rw-r--r--web/js/map-OpenStreetMap.js8
4 files changed, 11 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm
index ccbb3ca53..99904a328 100644
--- a/perllib/FixMyStreet/Map/OSM.pm
+++ b/perllib/FixMyStreet/Map/OSM.pm
@@ -15,13 +15,12 @@ sub header_js {
return '
<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript" src="/js/map-OpenStreetMap.js"></script>
-<script type="text/javascript" src="/js/OpenLayers.Projection.OrdnanceSurvey.js"></script>
';
}
# display_map Q PARAMS
# PARAMS include:
-# EASTING, NORTHING for the centre point of the map
+# latitude, longitude for the centre point of the map
# TYPE is 1 if the map is clickable, 2 if clickable and has a form upload,
# 0 if not clickable
# PINS is array of pins to show, location and colour
@@ -39,8 +38,8 @@ sub display_map {
$out .= <<EOF;
<script type="text/javascript">
var fixmystreet = {
- 'easting': $params{easting},
- 'northing': $params{northing},
+ 'latitude': $params{latitude},
+ 'longitude': $params{longitude},
'map_type': OpenLayers.Layer.OSM.Mapnik
}
</script>
diff --git a/perllib/Page.pm b/perllib/Page.pm
index 07e163b56..886c8d994 100644
--- a/perllib/Page.pm
+++ b/perllib/Page.pm
@@ -83,7 +83,7 @@ sub report_error {
my $msg_br = join '<br><br>', split m{\n}, $msg;
- print "Status: 500\nContent-Type: text/html; charset=iso-8859-1\n\n",
+ print "Status: 500\nContent-Type: text/html; charset=utf-8\n\n",
qq(<html><head><title>$somethingwrong</title></head></html>),
q(<body>),
qq(<h1>$somethingwrong</h1>),
diff --git a/perllib/Utils.pm b/perllib/Utils.pm
index 91dab033a..21994d20b 100644
--- a/perllib/Utils.pm
+++ b/perllib/Utils.pm
@@ -100,7 +100,9 @@ which is < 1m at the equator, if you're using WGS84 lat/lon.
sub truncate_coordinate {
my $in = shift;
- my $out = sprintf( '%0.6f', $in );
+ my $out = mySociety::Locale::in_gb_locale {
+ sprintf( '%0.6f', $in );
+ };
$out =~ s{\.?0+\z}{} if $out =~ m{\.};
return $out;
}
diff --git a/web/js/map-OpenStreetMap.js b/web/js/map-OpenStreetMap.js
index 04237e075..1eae62a9a 100644
--- a/web/js/map-OpenStreetMap.js
+++ b/web/js/map-OpenStreetMap.js
@@ -8,15 +8,15 @@ YAHOO.util.Event.onContentReady('map', function() {
],
displayProjection: new OpenLayers.Projection("EPSG:4326")
});
- var streetview = new fixmystreet.map_type("", {
+ var osm = new fixmystreet.map_type("", {
zoomOffset: 14,
numZoomLevels: 4
});
- map.addLayer(streetview);
+ map.addLayer(osm);
- var centre = new OpenLayers.LonLat( fixmystreet.easting, fixmystreet.northing );
+ var centre = new OpenLayers.LonLat( fixmystreet.longitude, fixmystreet.latitude );
centre.transform(
- new OpenLayers.Projection("EPSG:27700"),
+ new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
);
map.setCenter(centre, 2);