diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-05-11 10:44:51 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-05-11 10:44:51 +0100 |
commit | 2992b617968aa7d9b254673eb26283066af5ad56 (patch) | |
tree | 45df4964fc7d4e114150503c88b1fe9c95aba2ae | |
parent | 5e2a8889e27340dee9207d2360077973c9f8ba38 (diff) |
Different map base for Bromley.
-rw-r--r-- | perllib/FixMyStreet/Map/Bromley.pm | 23 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/FMS.pm | 13 | ||||
-rw-r--r-- | web/js/map-bing-ol.js | 13 |
3 files changed, 41 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/Map/Bromley.pm b/perllib/FixMyStreet/Map/Bromley.pm new file mode 100644 index 000000000..6d9dfa742 --- /dev/null +++ b/perllib/FixMyStreet/Map/Bromley.pm @@ -0,0 +1,23 @@ +#!/usr/bin/perl +# +# FixMyStreet:Map::Bromley +# Bromley have slightly different tiles, with trees etc. +# +# Copyright (c) 2012 UK Citizens Online Democracy. All rights reserved. +# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ + +package FixMyStreet::Map::Bromley; +use base 'FixMyStreet::Map::FMS'; + +use strict; + +sub map_type { + my $self = shift; + return '"' . $self->map_tile_base . '"'; +} + +sub map_tile_base { + return "tilma.mysociety.org/bromley"; +} + +1; diff --git a/perllib/FixMyStreet/Map/FMS.pm b/perllib/FixMyStreet/Map/FMS.pm index 24842c861..0ea4af4c1 100644 --- a/perllib/FixMyStreet/Map/FMS.pm +++ b/perllib/FixMyStreet/Map/FMS.pm @@ -37,14 +37,19 @@ sub get_quadkey { return $key; } +sub map_tile_base { + "tilma.mysociety.org/sv"; +} + sub map_tiles { my ($self, $x, $y, $z) = @_; if ($z >= 16) { + my $tile_base = $self->map_tile_base; return [ - "http://a.tilma.mysociety.org/sv/$z/" . ($x-1) . "/" . ($y-1) . ".png", - "http://b.tilma.mysociety.org/sv/$z/$x/" . ($y-1) . ".png", - "http://c.tilma.mysociety.org/sv/$z/" . ($x-1) . "/$y.png", - "http://tilma.mysociety.org/sv/$z/$x/$y.png", + "http://a.$tile_base/$z/" . ($x-1) . "/" . ($y-1) . ".png", + "http://b.$tile_base/$z/$x/" . ($y-1) . ".png", + "http://c.$tile_base/$z/" . ($x-1) . "/$y.png", + "http://$tile_base/$z/$x/$y.png", ]; } else { my $url = "g=701"; diff --git a/web/js/map-bing-ol.js b/web/js/map-bing-ol.js index 89b274b18..488dec58a 100644 --- a/web/js/map-bing-ol.js +++ b/web/js/map-bing-ol.js @@ -1,3 +1,5 @@ +var tile_base = 'tilma.mysociety.org/sv'; + function set_map_config(perm) { var permalink_id; if ($('#map_permalink').length) { @@ -17,6 +19,9 @@ function set_map_config(perm) { new OpenLayers.Control.Permalink(permalink_id), new OpenLayers.Control.PanZoomFMS({id: 'fms_pan_zoom' }) ]; + if (fixmystreet.map_type) { + tile_base = fixmystreet.map_type; + } fixmystreet.map_type = OpenLayers.Layer.Bing; } @@ -95,10 +100,10 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { var url; if (z >= 16) { url = [ - "http://tilma.mysociety.org/sv/${z}/${x}/${y}.png", - "http://a.tilma.mysociety.org/sv/${z}/${x}/${y}.png", - "http://b.tilma.mysociety.org/sv/${z}/${x}/${y}.png", - "http://c.tilma.mysociety.org/sv/${z}/${x}/${y}.png" + "http://" + tile_base + "/${z}/${x}/${y}.png", + "http://a." + tile_base + "/${z}/${x}/${y}.png", + "http://b." + tile_base + "/${z}/${x}/${y}.png", + "http://c." + tile_base + "/${z}/${x}/${y}.png" ]; } else { var type = ''; |