aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Map
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Map')
-rw-r--r--perllib/FixMyStreet/Map/Bing.pm55
-rw-r--r--perllib/FixMyStreet/Map/BingOL.pm70
-rw-r--r--perllib/FixMyStreet/Map/FMS.pm62
-rw-r--r--perllib/FixMyStreet/Map/Google.pm52
-rw-r--r--perllib/FixMyStreet/Map/OSM.pm191
-rw-r--r--perllib/FixMyStreet/Map/OSM/CycleMap.pm4
-rw-r--r--perllib/FixMyStreet/Map/OSM/StreetView.pm56
-rw-r--r--perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm71
-rw-r--r--perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm69
-rw-r--r--perllib/FixMyStreet/Map/Tilma/OpenLayers.pm35
-rw-r--r--perllib/FixMyStreet/Map/Tilma/Original.pm190
11 files changed, 264 insertions, 591 deletions
diff --git a/perllib/FixMyStreet/Map/Bing.pm b/perllib/FixMyStreet/Map/Bing.pm
index 335759b08..54979eba1 100644
--- a/perllib/FixMyStreet/Map/Bing.pm
+++ b/perllib/FixMyStreet/Map/Bing.pm
@@ -11,55 +11,18 @@ package FixMyStreet::Map::Bing;
use strict;
use mySociety::Web qw(ent);
-sub header_js {
- return '
-<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script>
-<script type="text/javascript" src="/js/map-bing.js"></script>
-';
-}
-
-# display_map Q PARAMS
+# display_map C PARAMS
# PARAMS include:
-# EASTING, NORTHING 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
+# latitude, longitude for the centre point of the map
+# CLICKABLE is set if the map is clickable
# PINS is array of pins to show, location and colour
-# PRE/POST are HTML to show above/below map
sub display_map {
- my ($self, $q, %params) = @_;
- $params{pre} ||= '';
- $params{post} ||= '';
-
- my @pins;
- foreach my $pin (@{$params{pins}}) {
- $pin->[3] ||= '';
- push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]";
- }
- my $pins_js = join(",\n", @pins);
-
- my $out = FixMyStreet::Map::header($q, $params{type});
- my $copyright = _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010.');
- my $key = mySociety::Config::get('BING_MAPS_API_KEY');
- $out .= <<EOF;
-<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}">
-<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}">
-<script type="text/javascript">
-var fixmystreet = {
- 'key': '$key',
- 'latitude': $params{latitude},
- 'longitude': $params{longitude},
- 'pins': [ $pins_js ]
-}
-</script>
-<div id="map_box">
- $params{pre}
- <div id="map"></div>
- <p id="copyright">$copyright</p>
- $params{post}
-</div>
-<div id="side">
-EOF
- return $out;
+ my ($self, $c, %params) = @_;
+ $c->stash->{map} = {
+ %params,
+ type => 'bing',
+ key => mySociety::Config::get('BING_MAPS_API_KEY'),
+ };
}
1;
diff --git a/perllib/FixMyStreet/Map/BingOL.pm b/perllib/FixMyStreet/Map/BingOL.pm
deleted file mode 100644
index 968642807..000000000
--- a/perllib/FixMyStreet/Map/BingOL.pm
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/perl
-#
-# FixMyStreet:Map::BingOL
-# Bing maps on FixMyStreet, using OpenLayers.
-#
-# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
-# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
-
-package FixMyStreet::Map::BingOL;
-
-use strict;
-use mySociety::Gaze;
-use mySociety::Web qw(ent);
-
-sub header_js {
- return '
-<!-- <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script> -->
-<script type="text/javascript" src="/jslib/OpenLayers-2.10/OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-bing-ol.js"></script>
-';
-}
-
-# display_map Q PARAMS
-# PARAMS include:
-# EASTING, NORTHING 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
-# PRE/POST are HTML to show above/below map
-sub display_map {
- my ($self, $q, %params) = @_;
- $params{pre} ||= '';
- $params{post} ||= '';
-
- my @pins;
- foreach my $pin (@{$params{pins}}) {
- $pin->[3] ||= '';
- push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]";
- }
- my $pins_js = join(",\n", @pins);
-
- 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}">
-<script type="text/javascript">
-var fixmystreet = {
- 'latitude': $params{latitude},
- 'longitude': $params{longitude},
- 'zoom': $zoom,
- 'pins': [ $pins_js ]
-}
-</script>
-<div id="map_box">
- $params{pre}
- <div id="map"></div>
- <p id="copyright">$copyright</p>
- $params{post}
-</div>
-<div id="side">
-EOF
- return $out;
-}
-
-1;
diff --git a/perllib/FixMyStreet/Map/FMS.pm b/perllib/FixMyStreet/Map/FMS.pm
new file mode 100644
index 000000000..d0a28be9b
--- /dev/null
+++ b/perllib/FixMyStreet/Map/FMS.pm
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+#
+# FixMyStreet:Map::FMS
+# Bing and OS StreetView maps on FixMyStreet, using OpenLayers.
+#
+# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
+
+package FixMyStreet::Map::FMS;
+use base 'FixMyStreet::Map::OSM';
+
+use strict;
+
+use constant ZOOM_LEVELS => 5;
+use constant MIN_ZOOM_LEVEL => 13;
+
+# Is set by the JavaScript
+sub map_type {
+ return '""';
+}
+
+sub map_template {
+ return 'fms';
+}
+
+sub copyright {
+ return _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010. Microsoft');
+}
+
+sub get_quadkey {
+ my ($x, $y, $z) = @_;
+ my $key = '';
+ for (my $i = $z; $i > 0; $i--) {
+ my $digit = 0;
+ my $mask = 1 << ($i - 1);
+ $digit++ if ($x & $mask) != 0;
+ $digit += 2 if ($y & $mask) != 0;
+ $key .= $digit;
+ }
+ return $key;
+}
+
+sub map_tiles {
+ my ($self, $x, $y, $z) = @_;
+ if ($z >= 16) {
+ return [
+ "http://a.os.openstreetmap.org/sv/$z/" . ($x-1) . "/" . ($y-1) . ".png",
+ "http://b.os.openstreetmap.org/sv/$z/$x/" . ($y-1) . ".png",
+ "http://c.os.openstreetmap.org/sv/$z/" . ($x-1) . "/$y.png",
+ "http://os.openstreetmap.org/sv/$z/$x/$y.png",
+ ];
+ } else {
+ return [
+ "http://ecn.t0.tiles.virtualearth.net/tiles/r" . get_quadkey($x-1, $y-1, $z) . ".png?g=587&productSet=mmOS",
+ "http://ecn.t1.tiles.virtualearth.net/tiles/r" . get_quadkey($x, $y-1, $z) . ".png?g=587&productSet=mmOS",
+ "http://ecn.t2.tiles.virtualearth.net/tiles/r" . get_quadkey($x-1, $y, $z) . ".png?g=587&productSet=mmOS",
+ "http://ecn.t3.tiles.virtualearth.net/tiles/r" . get_quadkey($x, $y, $z) . ".png?g=587&productSet=mmOS",
+ ];
+ }
+}
+
+1;
diff --git a/perllib/FixMyStreet/Map/Google.pm b/perllib/FixMyStreet/Map/Google.pm
index 35896108b..ceb3a53ed 100644
--- a/perllib/FixMyStreet/Map/Google.pm
+++ b/perllib/FixMyStreet/Map/Google.pm
@@ -11,53 +11,17 @@ package FixMyStreet::Map::Google;
use strict;
use mySociety::Web qw(ent);
-sub header_js {
- return '
-<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
-<script type="text/javascript" src="/js/map-google.js"></script>
-';
-}
-
-# display_map Q PARAMS
+# display_map C PARAMS
# PARAMS include:
-# EASTING, NORTHING 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
+# latitude, longitude for the centre point of the map
+# CLICKABLE is set if the map is clickable
# PINS is array of pins to show, location and colour
-# PRE/POST are HTML to show above/below map
sub display_map {
- my ($self, $q, %params) = @_;
- $params{pre} ||= '';
- $params{post} ||= '';
-
- my @pins;
- foreach my $pin (@{$params{pins}}) {
- $pin->[3] ||= '';
- push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]";
- }
- my $pins_js = join(",\n", @pins);
-
- my $out = FixMyStreet::Map::header($q, $params{type});
- my $copyright = _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010.');
- $out .= <<EOF;
-<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}">
-<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}">
-<script type="text/javascript">
-var fixmystreet = {
- 'latitude': $params{latitude},
- 'longitude': $params{longitude},
- 'pins': [ $pins_js ]
-}
-</script>
-<div id="map_box">
- $params{pre}
- <div id="map"></div>
- <p id="copyright">$copyright</p>
- $params{post}
-</div>
-<div id="side">
-EOF
- return $out;
+ my ($self, $c, %params) = @_;
+ $c->stash->{map} = {
+ %params,
+ type => 'google',
+ };
}
1;
diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm
index b930a4e4d..4543ce2da 100644
--- a/perllib/FixMyStreet/Map/OSM.pm
+++ b/perllib/FixMyStreet/Map/OSM.pm
@@ -10,116 +10,92 @@ package FixMyStreet::Map::OSM;
use strict;
use Math::Trig;
-use mySociety::Web qw(ent NewURL);
+use mySociety::Gaze;
use Utils;
-sub header_js {
- return '
-<script type="text/javascript" src="/jslib/OpenLayers-2.10/OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-OpenStreetMap.js"></script>
-';
-}
+use constant ZOOM_LEVELS => 5;
+use constant MIN_ZOOM_LEVEL => 13;
sub map_type {
return 'OpenLayers.Layer.OSM.Mapnik';
}
-# display_map Q PARAMS
+sub map_template {
+ return 'osm';
+}
+
+sub map_tiles {
+ my ($self, $x, $y, $z) = @_;
+ my $tile_url = $self->base_tile_url();
+ return [
+ "http://a.$tile_url/$z/" . ($x - 1) . "/" . ($y - 1) . ".png",
+ "http://b.$tile_url/$z/$x/" . ($y - 1) . ".png",
+ "http://c.$tile_url/$z/" . ($x - 1) . "/$y.png",
+ "http://$tile_url/$z/$x/$y.png",
+ ];
+}
+
+sub base_tile_url {
+ return 'tile.openstreetmap.org';
+}
+
+sub copyright {
+ return _('Map &copy; <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
-# TYPE is 1 if the map is clickable, 2 if clickable and has a form upload,
-# 0 if not clickable
+# CLICKABLE is set if the map is clickable
# PINS is array of pins to show, location and colour
-# PRE/POST are HTML to show above/below map
sub display_map {
- my ($self, $q, %params) = @_;
- $params{pre} ||= '';
- $params{post} ||= '';
+ my ($self, $c, %params) = @_;
- # Map centre may be overridden in the query string
- $params{latitude} = Utils::truncate_coordinate($q->param('lat')+0)
- if defined $q->param('lat');
- $params{longitude} = Utils::truncate_coordinate($q->param('lon')+0)
- if defined $q->param('lon');
+ # Adjust zoom level dependent upon population density
+ my $dist = mySociety::Gaze::get_radius_containing_population( $params{latitude}, $params{longitude}, 200_000 );
+ my $default_zoom = ZOOM_LEVELS - 3;
+ $default_zoom = ZOOM_LEVELS - 2 if $dist < 10;
- my $zoom = defined $q->param('zoom') ? $q->param('zoom') : 2;
- my $zoom_act = 14 + $zoom;
+ # Map centre may be overridden in the query string
+ $params{latitude} = Utils::truncate_coordinate($c->req->params->{lat} + 0)
+ if defined $c->req->params->{lat};
+ $params{longitude} = Utils::truncate_coordinate($c->req->params->{lon} + 0)
+ if defined $c->req->params->{lon};
+
+ my $zoom = defined $c->req->params->{zoom} ? $c->req->params->{zoom} + 0 : $default_zoom;
+ $zoom = ZOOM_LEVELS - 1 if $zoom >= ZOOM_LEVELS;
+ $zoom = 0 if $zoom < 0;
+ my $zoom_act = MIN_ZOOM_LEVEL + $zoom;
my ($x_tile, $y_tile) = latlon_to_tile_with_adjust($params{latitude}, $params{longitude}, $zoom_act);
- my $tl = ($x_tile-1) . "/" . ($y_tile-1);
- my $tr = "$x_tile/" . ($y_tile-1);
- my $bl = ($x_tile-1) . "/$y_tile";
- my $br = "$x_tile/$y_tile";
- my $tl_src = "http://a.tile.openstreetmap.org/$zoom_act/$tl.png";
- my $tr_src = "http://b.tile.openstreetmap.org/$zoom_act/$tr.png";
- my $bl_src = "http://c.tile.openstreetmap.org/$zoom_act/$bl.png";
- my $br_src = "http://tile.openstreetmap.org/$zoom_act/$br.png";
- map { s{/}{.} } ($tl, $tr, $bl, $br);
-
- my @pins;
- my $pins = '';
foreach my $pin (@{$params{pins}}) {
- $pin->[3] ||= '';
- push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]";
- $pins .= display_pin($q, $pin, $x_tile, $y_tile, $zoom_act);
+ ($pin->{px}, $pin->{py}) = latlon_to_px($pin->{latitude}, $pin->{longitude}, $x_tile, $y_tile, $zoom_act);
}
- my $pins_js = join(",\n", @pins);
- my $img_type;
- if ($params{type}) {
- $img_type = '<input type="image"';
- } else {
- $img_type = '<img';
- }
- my $out = FixMyStreet::Map::header($q, $params{type});
- my $copyright = _('Map &copy; <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>');
- my $compass = compass($q, $x_tile, $y_tile, $zoom);
- my $map_type = $self->map_type();
- $out .= <<EOF;
-<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}">
-<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}">
-<input type="hidden" name="zoom" value="$zoom">
-<script type="text/javascript">
-var fixmystreet = {
- 'latitude': $params{latitude},
- 'longitude': $params{longitude},
- 'pins': [ $pins_js ],
- 'map_type': $map_type
-}
-</script>
-<div id="map_box">
- $params{pre}
- <div id="map"><noscript>
- <div id="drag">$img_type alt="NW map tile" id="t2.2" name="tile_$tl" src="$tl_src" style="top:0; left:0;">$img_type alt="NE map tile" id="t2.3" name="tile_$tr" src="$tr_src" style="top:0px; left:256px;"><br>$img_type alt="SW map tile" id="t3.2" name="tile_$bl" src="$bl_src" style="top:256px; left:0;">$img_type alt="SE map tile" id="t3.3" name="tile_$br" src="$br_src" style="top:256px; left:256px;"></div>
- <div id="pins">$pins</div>
- $compass
- </noscript></div>
- <p id="copyright">$copyright</p>
- $params{post}
-</div>
-<div id="side">
-EOF
- return $out;
+ $c->stash->{map} = {
+ %params,
+ type => $self->map_template(),
+ map_type => $self->map_type(),
+ tiles => $self->map_tiles( $x_tile, $y_tile, $zoom_act ),
+ copyright => $self->copyright(),
+ x_tile => $x_tile,
+ y_tile => $y_tile,
+ zoom => $zoom,
+ zoom_act => $zoom_act,
+ zoom_levels => ZOOM_LEVELS,
+ compass => compass( $x_tile, $y_tile, $zoom_act ),
+ };
}
-sub display_pin {
- my ($q, $pin, $x_tile, $y_tile, $zoom) = @_;
-
- my ($px, $py) = latlon_to_px($pin->[0], $pin->[1], $x_tile, $y_tile, $zoom);
-
- my $num = '';
- my $host = Page::base_url_with_lang($q, undef);
- my %cols = (red=>'R', green=>'G', blue=>'B', purple=>'P');
- my $out = '<img border="0" class="pin" src="' . $host . '/i/pin' . $cols{$pin->[2]}
- . $num . '.gif" alt="' . _('Problem') . '" style="top:' . ($py-59)
- . 'px; left:' . ($px) . 'px; position: absolute;">';
- return $out unless $pin->[3];
- my $cobrand = Page::get_cobrand($q);
- my $url = Cobrand::url($cobrand, NewURL($q, -url => '/report/' . $pin->[3]), $q);
- # XXX Would like to include title here in title=""
- $out = '<a href="' . $url . '">' . $out . '</a>';
- return $out;
+sub compass {
+ my ( $x, $y, $z ) = @_;
+ return {
+ north => [ map { Utils::truncate_coordinate($_) } tile_to_latlon( $x, $y-1, $z ) ],
+ south => [ map { Utils::truncate_coordinate($_) } tile_to_latlon( $x, $y+1, $z ) ],
+ west => [ map { Utils::truncate_coordinate($_) } tile_to_latlon( $x-1, $y, $z ) ],
+ east => [ map { Utils::truncate_coordinate($_) } tile_to_latlon( $x+1, $y, $z ) ],
+ here => [ map { Utils::truncate_coordinate($_) } tile_to_latlon( $x, $y, $z ) ],
+ };
}
# Given a lat/lon, convert it to OSM tile co-ordinates (precise).
@@ -183,43 +159,12 @@ sub click_to_tile {
# Given some click co-ords (the tile they were on, and where in the
# tile they were), convert to WGS84 and return.
sub click_to_wgs84 {
- my ($self, $q, $pin_tile_x, $pin_x, $pin_tile_y, $pin_y) = @_;
+ my ($self, $c, $pin_tile_x, $pin_x, $pin_tile_y, $pin_y) = @_;
my $tile_x = click_to_tile($pin_tile_x, $pin_x);
my $tile_y = click_to_tile($pin_tile_y, $pin_y);
- my $zoom = 14 + (defined $q->param('zoom') ? $q->param('zoom') : 2);
+ my $zoom = MIN_ZOOM_LEVEL + (defined $c->req->params->{zoom} ? $c->req->params->{zoom} : 3);
my ($lat, $lon) = tile_to_latlon($tile_x, $tile_y, $zoom);
return ( $lat, $lon );
}
-sub compass ($$$$) {
- my ( $q, $x, $y, $zoom ) = @_;
-
- my ($lat, $lon) = map { Utils::truncate_coordinate($_) } tile_to_latlon($x, $y-1, $zoom+14);
- my $north = NewURL( $q, lat => $lat, lon => $lon, zoom => $zoom );
- ($lat, $lon) = map { Utils::truncate_coordinate($_) } tile_to_latlon($x, $y+1, $zoom+14);
- my $south = NewURL( $q, lat => $lat, lon => $lon, zoom => $zoom );
- ($lat, $lon) = map { Utils::truncate_coordinate($_) } tile_to_latlon($x-1, $y, $zoom+14);
- my $west = NewURL( $q, lat => $lat, lon => $lon, zoom => $zoom );
- ($lat, $lon) = map { Utils::truncate_coordinate($_) } tile_to_latlon($x+1, $y, $zoom+14);
- my $east = NewURL( $q, lat => $lat, lon => $lon, zoom => $zoom );
- ($lat, $lon) = map { Utils::truncate_coordinate($_) } tile_to_latlon($x, $y, $zoom+14);
- my $zoom_in = $zoom < 3 ? NewURL( $q, lat => $lat, lon => $lon, zoom => $zoom+1 ) : '#';
- my $zoom_out = $zoom > 0 ? NewURL( $q, lat => $lat, lon => $lon, zoom => $zoom-1 ) : '#';
- my $world = NewURL( $q, lat => $lat, lon => $lon, zoom => 0 );
-
- #my $host = Page::base_url_with_lang( $q, undef );
- my $dir = "/jslib/OpenLayers-2.10/img";
- return <<EOF;
-<div style="position: absolute; left: 4px; top: 4px; z-index: 1007;" class="olControlPanZoom olControlNoSelect" unselectable="on">
- <div style="position: absolute; left: 13px; top: 4px; width: 18px; height: 18px;"><a href="$north"><img style="position: relative; width: 18px; height: 18px;" src="$dir/north-mini.png" border="0"></a></div>
- <div style="position: absolute; left: 4px; top: 22px; width: 18px; height: 18px;"><a href="$west"><img style="position: relative; width: 18px; height: 18px;" src="$dir/west-mini.png" border="0"></a></div>
- <div style="position: absolute; left: 22px; top: 22px; width: 18px; height: 18px;"><a href="$east"><img style="position: relative; width: 18px; height: 18px;" src="$dir/east-mini.png" border="0"></a></div>
- <div style="position: absolute; left: 13px; top: 40px; width: 18px; height: 18px;"><a href="$south"><img style="position: relative; width: 18px; height: 18px;" src="$dir/south-mini.png" border="0"></a></div>
- <div style="position: absolute; left: 13px; top: 63px; width: 18px; height: 18px;"><a href="$zoom_in"><img style="position: relative; width: 18px; height: 18px;" src="$dir/zoom-plus-mini.png" border="0"></a></div>
- <div style="position: absolute; left: 13px; top: 81px; width: 18px; height: 18px;"><a href="$world"><img style="position: relative; width: 18px; height: 18px;" src="$dir/zoom-world-mini.png" border="0"></a></div>
- <div style="position: absolute; left: 13px; top: 99px; width: 18px; height: 18px;"><a href="$zoom_out"><img style="position: relative; width: 18px; height: 18px;" src="$dir/zoom-minus-mini.png" border="0"></a></div>
-</div>
-EOF
-}
-
1;
diff --git a/perllib/FixMyStreet/Map/OSM/CycleMap.pm b/perllib/FixMyStreet/Map/OSM/CycleMap.pm
index 06b07ae20..71b86de8f 100644
--- a/perllib/FixMyStreet/Map/OSM/CycleMap.pm
+++ b/perllib/FixMyStreet/Map/OSM/CycleMap.pm
@@ -15,4 +15,8 @@ sub map_type {
return 'OpenLayers.Layer.OSM.CycleMap';
}
+sub base_tile_url {
+ return 'tile.opencyclemap.org/cycle';
+}
+
1;
diff --git a/perllib/FixMyStreet/Map/OSM/StreetView.pm b/perllib/FixMyStreet/Map/OSM/StreetView.pm
index 9c9a1ac8e..141c2e328 100644
--- a/perllib/FixMyStreet/Map/OSM/StreetView.pm
+++ b/perllib/FixMyStreet/Map/OSM/StreetView.pm
@@ -7,58 +7,24 @@
# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
package FixMyStreet::Map::OSM::StreetView;
+use base 'FixMyStreet::Map::OSM';
use strict;
-use mySociety::Web qw(ent);
-sub header_js {
- return '
-<script type="text/javascript" src="/jslib/OpenLayers-2.10/OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-streetview.js"></script>
-';
+sub map_type {
+ return '""';
}
-# display_map Q PARAMS
-# PARAMS include:
-# EASTING, NORTHING 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
-# PRE/POST are HTML to show above/below map
-sub display_map {
- my ($self, $q, %params) = @_;
- $params{pre} ||= '';
- $params{post} ||= '';
-
- my @pins;
- foreach my $pin (@{$params{pins}}) {
- $pin->[3] ||= '';
- push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]";
- }
- my $pins_js = join(",\n", @pins);
+sub map_template {
+ return 'osm-streetview';
+}
- my $out = FixMyStreet::Map::header($q, $params{type});
- my $copyright = _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010.');
- $out .= <<EOF;
-<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}">
-<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}">
-<script type="text/javascript">
-var fixmystreet = {
- 'latitude': $params{latitude},
- 'longitude': $params{longitude},
- 'pins': [ $pins_js ]
+sub base_tile_url {
+ return 'os.openstreetmap.org/sv';
}
-</script>
-<div id="map_box">
- $params{pre}
- <div id="map"></div>
- <p id="copyright">$copyright</p>
- $params{post}
-</div>
-<div id="side">
-EOF
- return $out;
+
+sub copyright {
+ return _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010.');
}
1;
diff --git a/perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm b/perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm
index 9ae5829c4..34df8dc8b 100644
--- a/perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm
+++ b/perllib/FixMyStreet/Map/Tilma/OL/1_10k.pm
@@ -7,73 +7,22 @@
# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
package FixMyStreet::Map::Tilma::OL::1_10k;
+use base 'FixMyStreet::Map::Tilma::OpenLayers';
use strict;
-use constant TILE_WIDTH => 254;
-use constant TIF_SIZE_M => 5000;
-use constant TIF_SIZE_PX => 7874;
-use constant SCALE_FACTOR => TIF_SIZE_M / (TIF_SIZE_PX / TILE_WIDTH);
-use constant TILE_TYPE => '10k-full';
+sub tile_width { return 254; }
+sub tif_size_m { return 5000; }
+sub tif_size_px { return 7874; }
+sub scale_factor { return tif_size_m() / (tif_size_px() / tile_width()); }
+sub tile_type { return '10k-full'; }
-sub header_js {
- return '
-<script type="text/javascript" src="/jslib/OpenLayers-2.10/OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-tilma-ol.js"></script>
-<script type="text/javascript" src="/js/OpenLayers.Projection.OrdnanceSurvey.js"></script>
-';
+sub copyright {
+ return _('&copy; Crown copyright. All rights reserved. Ministry of Justice 100037819&nbsp;2008.');
}
-# display_map Q PARAMS
-# PARAMS include:
-# EASTING, NORTHING 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
-# PRE/POST are HTML to show above/below map
-sub display_map {
- my ($self, $q, %params) = @_;
- $params{pre} ||= '';
- $params{post} ||= '';
-
- my @pins;
- foreach my $pin (@{$params{pins}}) {
- $pin->[3] ||= '';
- push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]";
- }
- my $pins_js = join(",\n", @pins);
-
- my $out = FixMyStreet::Map::header($q, $params{type});
- my $tile_width = TILE_WIDTH;
- my $tile_type = TILE_TYPE;
- my $sf = SCALE_FACTOR / TILE_WIDTH;
- my $copyright = _('&copy; Crown copyright. All rights reserved. Ministry of Justice 100037819&nbsp;2008.');
- $out .= <<EOF;
-<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}">
-<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}">
-<script type="text/javascript">
-var fixmystreet = {
- 'tilewidth': $tile_width,
- 'tileheight': $tile_width,
- 'latitude': $params{latitude},
- 'longitude': $params{longitude},
- 'pins': [ $pins_js ],
- 'tile_type': '$tile_type',
- 'maxResolution': $sf
-};
-</script>
-<div id="map_box">
- $params{pre}
- <div id="map">
- <div id="watermark"></div>
- </div>
- <p id="copyright">$copyright</p>
-$params{post}
-</div>
-<div id="side">
-EOF
- return $out;
+sub watermark {
+ return 1;
}
1;
diff --git a/perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm b/perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm
index 7a898b55b..2a531766c 100644
--- a/perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm
+++ b/perllib/FixMyStreet/Map/Tilma/OL/StreetView.pm
@@ -7,71 +7,22 @@
# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
package FixMyStreet::Map::Tilma::OL::StreetView;
+use base 'FixMyStreet::Map::Tilma::OpenLayers';
use strict;
-use constant TILE_WIDTH => 250;
-use constant TIF_SIZE_M => 5000;
-use constant TIF_SIZE_PX => 5000;
-use constant SCALE_FACTOR => TIF_SIZE_M / (TIF_SIZE_PX / TILE_WIDTH);
-use constant TILE_TYPE => 'streetview';
+sub tile_width { return 250; }
+sub tif_size_m { return 5000; }
+sub tif_size_px { return 5000; }
+sub scale_factor { return tif_size_m() / (tif_size_px() / tile_width()); }
+sub tile_type { return 'streetview'; }
-sub header_js {
- return '
-<script type="text/javascript" src="/jslib/OpenLayers-2.10/OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-OpenLayers.js"></script>
-<script type="text/javascript" src="/js/map-tilma-ol.js"></script>
-<script type="text/javascript" src="/js/OpenLayers.Projection.OrdnanceSurvey.js"></script>
-';
+sub copyright {
+ return _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010.');
}
-# display_map Q PARAMS
-# PARAMS include:
-# EASTING, NORTHING 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
-# PRE/POST are HTML to show above/below map
-sub display_map {
- my ($self, $q, %params) = @_;
- $params{pre} ||= '';
- $params{post} ||= '';
-
- my @pins;
- foreach my $pin (@{$params{pins}}) {
- $pin->[3] ||= '';
- push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]";
- }
- my $pins_js = join(",\n", @pins);
-
- my $out = FixMyStreet::Map::header($q, $params{type});
- my $tile_width = TILE_WIDTH;
- my $tile_type = TILE_TYPE;
- my $sf = SCALE_FACTOR / TILE_WIDTH;
- my $copyright = _('Map contains Ordnance Survey data &copy; Crown copyright and database right 2010.');
- $out .= <<EOF;
-<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}">
-<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}">
-<script type="text/javascript">
-var fixmystreet = {
- 'tilewidth': $tile_width,
- 'tileheight': $tile_width,
- 'latitude': $params{latitude},
- 'longitude': $params{longitude},
- 'pins': [ $pins_js ],
- 'tile_type': '$tile_type',
- 'maxResolution': $sf
-};
-</script>
-<div id="map_box">
- $params{pre}
- <div id="map"></div>
- <p id="copyright">$copyright</p>
- $params{post}
-</div>
-<div id="side">
-EOF
- return $out;
+sub watermark {
+ return 0;
}
1;
diff --git a/perllib/FixMyStreet/Map/Tilma/OpenLayers.pm b/perllib/FixMyStreet/Map/Tilma/OpenLayers.pm
new file mode 100644
index 000000000..31e9eb096
--- /dev/null
+++ b/perllib/FixMyStreet/Map/Tilma/OpenLayers.pm
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+#
+# FixMyStreet:Map::Tilma::1_10k_OL
+# Using tilma.mysociety.org with OpenLayers
+#
+# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved.
+# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/
+
+package FixMyStreet::Map::Tilma::OpenLayers;
+
+use strict;
+
+sub TILE_WIDTH() { return $FixMyStreet::Map::map_class->tile_width; }
+sub SCALE_FACTOR() { return $FixMyStreet::Map::map_class->scale_factor; }
+sub TILE_TYPE() { return $FixMyStreet::Map::map_class->tile_type; }
+
+# display_map C PARAMS
+# PARAMS include:
+# latitude, longitude for the centre point of the map
+# TYPE is 1 if the map is clickable, 0 otherwise.
+# PINS is array of pins to show, location and colour
+sub display_map {
+ my ($self, $c, %params) = @_;
+ $c->stash->{map} = {
+ %params,
+ type => 'tilma/openlayers',
+ tile_type => TILE_TYPE,
+ tilewidth => TILE_WIDTH,
+ watermark => $self->watermark(),
+ copyright => $self->copyright(),
+ maxResolution => SCALE_FACTOR / TILE_WIDTH,
+ };
+}
+
+1;
diff --git a/perllib/FixMyStreet/Map/Tilma/Original.pm b/perllib/FixMyStreet/Map/Tilma/Original.pm
index 0af6ed277..6fa854cb2 100644
--- a/perllib/FixMyStreet/Map/Tilma/Original.pm
+++ b/perllib/FixMyStreet/Map/Tilma/Original.pm
@@ -11,7 +11,6 @@ package FixMyStreet::Map::Tilma::Original;
use strict;
use LWP::Simple;
-use Cobrand;
use mySociety::GeoUtil;
use mySociety::Locale;
use mySociety::Web qw(ent NewURL);
@@ -27,25 +26,15 @@ sub _ll_to_en {
return Utils::convert_latlon_to_en( $lat, $lon );
}
-sub header_js {
- return '
-<script type="text/javascript" src="/js/map-tilma.js"></script>
-';
-}
-
-# display_map Q PARAMS
+# display_map C PARAMS
# PARAMS include:
# 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
+# CLICKABLE is set if the map is clickable
# PINS is array of pins to show, location and colour
-# PRE/POST are HTML to show above/below map
sub display_map {
- my ($self, $q, %params) = @_;
- $params{pre} ||= '';
- $params{post} ||= '';
+ my ($self, $c, %params) = @_;
my $mid_point = TILE_WIDTH; # Map is 2 TILE_WIDTHs in size, square.
- if (my $mp = Cobrand::tilma_mid_point(Page::get_cobrand($q))) {
+ if (my $mp = $c->cobrand->tilma_mid_point) {
$mid_point = $mp;
}
@@ -53,27 +42,18 @@ sub display_map {
( $params{easting}, $params{northing} ) =
_ll_to_en( $params{latitude}, $params{longitude} );
- # FIXME - convert all pins to lat, lng
- # all the pins are currently [lat, lng, colour] - convert them
- foreach my $pin ( @{ $params{pins} ||= [] } ) {
- my ( $lat, $lon ) = ( $pin->[0], $pin->[1] );
- my ( $e, $n ) = _ll_to_en( $lat, $lon );
- ( $pin->[0], $pin->[1] ) = ( $e, $n );
- }
-
# X/Y tile co-ords may be overridden in the query string
my @vars = qw(x y);
- my %input = map { $_ => $q->param($_) || '' } @vars;
+ my %input = map { $_ => $c->req->params->{$_} || '' } @vars;
($input{x}) = $input{x} =~ /^(\d+)/; $input{x} ||= 0;
($input{y}) = $input{y} =~ /^(\d+)/; $input{y} ||= 0;
- my ($x, $y, $px, $py) = os_to_px_with_adjust($q, $params{easting}, $params{northing}, $input{x}, $input{y});
+ my ($x, $y, $px, $py) = os_to_px_with_adjust($c, $params{easting}, $params{northing}, $input{x}, $input{y});
- my $pins = '';
foreach my $pin (@{$params{pins}}) {
- my $pin_x = os_to_px($pin->[0], $x);
- my $pin_y = os_to_px($pin->[1], $y, 1);
- $pins .= display_pin($q, $pin_x, $pin_y, $pin->[2]);
+ my ( $e, $n ) = _ll_to_en( $pin->{latitude}, $pin->{longitude} );
+ $pin->{px} = os_to_px($e, $x);
+ $pin->{py} = os_to_px($n, $y, 1);
}
$px = defined($px) ? $mid_point - $px : 0;
@@ -83,111 +63,66 @@ sub display_map {
my $url = 'http://tilma.mysociety.org/tileserver/' . TILE_TYPE . '/';
my $tiles_url = $url . ($x-1) . '-' . $x . ',' . ($y-1) . '-' . $y . '/RABX';
my $tiles = LWP::Simple::get($tiles_url);
- return '<div id="map_box"> <div id="map"><div id="drag">' . _("Unable to fetch the map tiles from the tile server.") . '</div></div></div><div id="side">' if !$tiles;
my $tileids = RABX::unserialise($tiles);
- my $tl = ($x-1) . '.' . $y;
- my $tr = $x . '.' . $y;
- my $bl = ($x-1) . '.' . ($y-1);
- my $br = $x . '.' . ($y-1);
- return '<div id="side">' if (!$tileids->[0][0] || !$tileids->[0][1] || !$tileids->[1][0] || !$tileids->[1][1]);
- my $tl_src = $url . $tileids->[0][0];
- my $tr_src = $url . $tileids->[0][1];
- my $bl_src = $url . $tileids->[1][0];
- my $br_src = $url . $tileids->[1][1];
-
- my $cobrand = Page::get_cobrand($q);
- my $root_path_js = Cobrand::root_path_js($cobrand, $q);
- my $out = FixMyStreet::Map::header($q, $params{type});
- my $img_type;
- if ($params{type}) {
- $out .= <<EOF;
-<input type="hidden" name="x" id="formX" value="$x">
-<input type="hidden" name="y" id="formY" value="$y">
-<input type="hidden" name="latitude" value="$params{latitude}">
-<input type="hidden" name="longitude" value="$params{longitude}">
-EOF
- $img_type = '<input type="image"';
- } else {
- $img_type = '<img';
- }
- my $imgw = TILE_WIDTH . 'px';
- my $tile_width = TILE_WIDTH;
- my $tile_type = TILE_TYPE;
- $out .= <<EOF;
-<script type="text/javascript">
-$root_path_js
-var fixmystreet = {
- 'x': $x - 3,
- 'y': $y - 3,
- 'start_x': $px,
- 'start_y': $py,
- 'tile_type': '$tile_type',
- 'tilewidth': $tile_width,
- 'tileheight': $tile_width
-};
-</script>
-<div id="map_box">
-$params{pre}
- <div id="map"><div id="drag">
- $img_type alt="NW map tile" id="t2.2" name="tile_$tl" src="$tl_src" style="top:0px; left:0;">$img_type alt="NE map tile" id="t2.3" name="tile_$tr" src="$tr_src" style="top:0px; left:$imgw;"><br>$img_type alt="SW map tile" id="t3.2" name="tile_$bl" src="$bl_src" style="top:$imgw; left:0;">$img_type alt="SE map tile" id="t3.3" name="tile_$br" src="$br_src" style="top:$imgw; left:$imgw;">
- <div id="pins">$pins</div>
- </div>
-EOF
- $out .= '<div id="watermark"></div>' if $self->watermark();
- $out .= compass($q, $x, $y);
- my $copyright = $self->copyright();
- $out .= <<EOF;
- </div>
- <p id="copyright">$copyright</p>
-$params{post}
-</div>
-<div id="side">
-EOF
- return $out;
+ $c->stash->{map} = {
+ %params,
+ type => 'tilma/original',
+ tiles => $tiles,
+ url => $url,
+ tileids => $tileids,
+ x => $x,
+ y => $y,
+ px => $px,
+ py => $py,
+ tile_type => TILE_TYPE,
+ tilewidth => TILE_WIDTH,
+ watermark => $self->watermark(),
+ copyright => $self->copyright(),
+ };
}
sub display_pin {
- my ($q, $px, $py, $col, $num) = @_;
+ my ($c, $px, $py, $col, $id, $title, $num) = @_;
$num = '' if !$num || $num > 9;
- my $host = Page::base_url_with_lang($q, undef);
+ my $host = $c->cobrand->base_url_with_lang;
my %cols = (red=>'R', green=>'G', blue=>'B', purple=>'P');
my $out = '<img class="pin" src="' . $host . '/i/pin' . $cols{$col}
. $num . '.gif" alt="' . _('Problem') . '" style="top:' . ($py-59)
. 'px; left:' . ($px) . 'px; position: absolute;">';
- return $out unless $_ && $_->{id} && $col ne 'blue';
- my $cobrand = Page::get_cobrand($q);
- my $url = Cobrand::url($cobrand, NewURL($q, -url => '/report/' . $_->{id}), $q);
- $out = '<a title="' . ent($_->{title}) . '" href="' . $url . '">' . $out . '</a>';
+ return $out unless $id;
+ my $url = $c->uri_for( '/report/' . $id );
+ $out = '<a title="' . ent($title) . '" href="' . $url . '">' . $out . '</a>';
return $out;
}
sub map_pins {
- my ($self, $q, $x, $y, $sx, $sy, $interval) = @_;
+ my ($self, $c, $x, $y, $sx, $sy, $interval) = @_;
my $e = tile_to_os($x);
my $n = tile_to_os($y);
my ( $lat, $lon ) = Utils::convert_en_to_latlon( $e, $n );
my ( $around_map, $around_map_list, $nearby, $dist ) =
- FixMyStreet::Map::map_features( $q, $lat, $lon, $interval );
+ FixMyStreet::Map::map_features( $c, $lat, $lon, $interval );
my $pins = '';
foreach (@$around_map) {
- ( $_->{easting}, $_->{northing} ) =
- _ll_to_en( $_->{latitude}, $_->{longitude} );
- my $px = os_to_px($_->{easting}, $sx);
- my $py = os_to_px($_->{northing}, $sy, 1);
- my $col = $_->{state} eq 'fixed' ? 'green' : 'red';
- $pins .= display_pin($q, $px, $py, $col);
+ my ( $easting, $northing ) =
+ _ll_to_en( $_->latitude, $_->longitude );
+ my $px = os_to_px($easting, $sx);
+ my $py = os_to_px($northing, $sy, 1);
+ my $col = $_->state eq 'fixed' ? 'green' : 'red';
+ $pins .= display_pin($c, $px, $py, $col, $_->id, $_->title);
}
foreach (@$nearby) {
- ( $_->{easting}, $_->{northing} ) =
- _ll_to_en( $_->{latitude}, $_->{longitude} );
- my $px = os_to_px($_->{easting}, $sx);
- my $py = os_to_px($_->{northing}, $sy, 1);
- my $col = $_->{state} eq 'fixed' ? 'green' : 'red';
- $pins .= display_pin($q, $px, $py, $col);
+ my $p = $_->problem;
+ my ( $easting, $northing ) =
+ _ll_to_en( $p->latitude, $p->longitude );
+ my $px = os_to_px($easting, $sx);
+ my $py = os_to_px($northing, $sy, 1);
+ my $col = $p->state eq 'fixed' ? 'green' : 'red';
+ $pins .= display_pin($c, $px, $py, $col, $p->id, $p->title);
}
return ($pins, $around_map_list, $nearby, $dist);
@@ -262,7 +197,7 @@ sub click_to_os {
# tile they were), convert to WGS84 and return.
sub click_to_wgs84 {
my $self = shift;
- my $q = shift;
+ my $c = shift;
my ( $easting, $northing ) = click_to_os(@_);
my ( $lat, $lon ) = mySociety::GeoUtil::national_grid_to_wgs84( $easting, $northing, 'G' );
return ( $lat, $lon );
@@ -272,7 +207,7 @@ sub click_to_wgs84 {
# of the map (either to get the point near the middle, or the override X,Y),
# and the pixel co-ords of the point, relative to that map.
sub os_to_px_with_adjust {
- my ($q, $easting, $northing, $in_x, $in_y) = @_;
+ my ($c, $easting, $northing, $in_x, $in_y) = @_;
my $x = os_to_tile($easting);
my $y = os_to_tile($northing);
@@ -289,7 +224,7 @@ sub os_to_px_with_adjust {
my $px = os_to_px($easting, $x_tile);
my $py = os_to_px($northing, $y_tile, 1);
- if ($q->{site} eq 'barnet') { # Map is 380px, so might need to adjust
+ if ($c->cobrand->tilma_mid_point == 189) { # Map is 380px, so might need to adjust
if (!$in_x && $px > 380) {
$x_tile++;
$px = os_to_px($easting, $x_tile);
@@ -303,35 +238,4 @@ sub os_to_px_with_adjust {
return ($x_tile, $y_tile, $px, $py);
}
-sub compass ($$$) {
- my ( $q, $x, $y ) = @_;
- my @compass;
- for ( my $i = $x - 1 ; $i <= $x + 1 ; $i++ ) {
- for ( my $j = $y - 1 ; $j <= $y + 1 ; $j++ ) {
- $compass[$i][$j] = NewURL( $q, x => $i, y => $j );
- }
- }
- my $recentre = NewURL($q);
- my $host = Page::base_url_with_lang( $q, undef );
- return <<EOF;
-<table cellpadding="0" cellspacing="0" border="0" id="compass">
-<tr valign="bottom">
-<td align="right"><a rel="nofollow" href="${compass[$x-1][$y+1]}"><img src="$host/i/arrow-northwest.gif" alt="NW" width=11 height=11></a></td>
-<td align="center"><a rel="nofollow" href="${compass[$x][$y+1]}"><img src="$host/i/arrow-north.gif" vspace="3" alt="N" width=13 height=11></a></td>
-<td><a rel="nofollow" href="${compass[$x+1][$y+1]}"><img src="$host/i/arrow-northeast.gif" alt="NE" width=11 height=11></a></td>
-</tr>
-<tr>
-<td><a rel="nofollow" href="${compass[$x-1][$y]}"><img src="$host/i/arrow-west.gif" hspace="3" alt="W" width=11 height=13></a></td>
-<td align="center"><a rel="nofollow" href="$recentre"><img src="$host/i/rose.gif" alt="Recentre" width=35 height=34></a></td>
-<td><a rel="nofollow" href="${compass[$x+1][$y]}"><img src="$host/i/arrow-east.gif" hspace="3" alt="E" width=11 height=13></a></td>
-</tr>
-<tr valign="top">
-<td align="right"><a rel="nofollow" href="${compass[$x-1][$y-1]}"><img src="$host/i/arrow-southwest.gif" alt="SW" width=11 height=11></a></td>
-<td align="center"><a rel="nofollow" href="${compass[$x][$y-1]}"><img src="$host/i/arrow-south.gif" vspace="3" alt="S" width=13 height=11></a></td>
-<td><a rel="nofollow" href="${compass[$x+1][$y-1]}"><img src="$host/i/arrow-southeast.gif" alt="SE" width=11 height=11></a></td>
-</tr>
-</table>
-EOF
-}
-
1;