aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@fury.ukcod.org.uk>2011-04-21 09:37:34 +0100
committerMatthew Somerville <matthew@fury.ukcod.org.uk>2011-04-21 09:37:34 +0100
commit83bfa3d8c656a9a1422a6f266c44b3d9c398fc51 (patch)
treee078a9c226b154fa677040c3d1f84983714883a2
parent5e4eaf9f30bfa1d37426ff7d4e0295f6718ba28f (diff)
Start introducing variable zoom dependent on location.
-rw-r--r--perllib/FixMyStreet/Map/BingOL.pm5
-rw-r--r--web/js/map-OpenLayers.js2
2 files changed, 6 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/Map/BingOL.pm b/perllib/FixMyStreet/Map/BingOL.pm
index 4e93243a9..968642807 100644
--- a/perllib/FixMyStreet/Map/BingOL.pm
+++ b/perllib/FixMyStreet/Map/BingOL.pm
@@ -9,6 +9,7 @@
package FixMyStreet::Map::BingOL;
use strict;
+use mySociety::Gaze;
use mySociety::Web qw(ent);
sub header_js {
@@ -41,6 +42,9 @@ sub display_map {
my $out = FixMyStreet::Map::header($q, $params{type});
my $copyright = _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010. Microsoft');
+ my $dist = mySociety::Gaze::get_radius_containing_population( $params{latitude}, $params{longitude}, 200_000 );
+ my $zoom = 2;
+ $zoom = 3 if $dist < 10;
$out .= <<EOF;
<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}">
<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}">
@@ -48,6 +52,7 @@ sub display_map {
var fixmystreet = {
'latitude': $params{latitude},
'longitude': $params{longitude},
+ 'zoom': $zoom,
'pins': [ $pins_js ]
}
</script>
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 1134bafb7..ed3ca4653 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -24,7 +24,7 @@ YAHOO.util.Event.onContentReady('map', function() {
new OpenLayers.Projection("EPSG:4326"),
fixmystreet.map.getProjectionObject()
);
- fixmystreet.map.setCenter(centre, 2);
+ fixmystreet.map.setCenter(centre, fixmystreet.zoom || 2);
}
if (document.getElementById('mapForm')) {