diff options
Diffstat (limited to 'perllib/FixMyStreet/Map/OSM.pm')
-rw-r--r-- | perllib/FixMyStreet/Map/OSM.pm | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm index 9ccbac017..aeece3960 100644 --- a/perllib/FixMyStreet/Map/OSM.pm +++ b/perllib/FixMyStreet/Map/OSM.pm @@ -10,7 +10,6 @@ package FixMyStreet::Map::OSM; use strict; use Math::Trig; -use mySociety::Web qw(ent NewURL); use Utils; sub header_js { @@ -25,6 +24,14 @@ sub map_type { return 'OpenLayers.Layer.OSM.Mapnik'; } +sub base_tile_url { + return 'tile.openstreetmap.org'; +} + +sub copyright { + return _('Map © <a id="osm_link" href="http://www.openstreetmap.org/">OpenStreetMap</a> and contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'); +} + # display_map C PARAMS # PARAMS include: # latitude, longitude for the centre point of the map @@ -45,18 +52,8 @@ sub display_map { my $zoom_act = 14 + $zoom; my ($x_tile, $y_tile) = latlon_to_tile_with_adjust($params{latitude}, $params{longitude}, $zoom_act); - my @pins; foreach my $pin (@{$params{pins}}) { - my ($px, $py) = latlon_to_px($pin->[0], $pin->[1], $x_tile, $y_tile, $zoom_act); - push @pins, { - lat => $pin->[0], - lon => $pin->[1], - px => $px, - py => $py, - col => $pin->[2], - id => $pin->[3], - title => $pin->[4], - }; + ($pin->{px}, $pin->{py}) = latlon_to_px($pin->{latitude}, $pin->{longitude}, $x_tile, $y_tile, $zoom_act); } my $compass = { @@ -72,11 +69,13 @@ sub display_map { latitude => $params{latitude}, longitude => $params{longitude}, map_type => $self->map_type(), + tile_url => $self->base_tile_url(), + copyright => $self->copyright(), x_tile => $x_tile, y_tile => $y_tile, zoom => $zoom, zoom_act => $zoom_act, - pins => \@pins, + pins => $params{pins}, compass => $compass, }; } |