aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-08-17 16:35:42 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-08-17 16:36:50 +0100
commit1897528940634df65483024e4f9421d2c3476da0 (patch)
tree4833ceadf5182fc97852e86b178b5913b13b18d3
parentb0db6ccae8f2e2c35b2c503baf0f86b269435f9b (diff)
[Zurich] Fix server side map tile URL generation.
@scales does not include the hidden zoom levels, so we need to offset the matrix ID to be correct in the URL but not do so to calculate the tile row and column.
-rw-r--r--perllib/FixMyStreet/Map/WMTSBase.pm5
-rw-r--r--perllib/FixMyStreet/Map/Zurich.pm4
2 files changed, 4 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/Map/WMTSBase.pm b/perllib/FixMyStreet/Map/WMTSBase.pm
index c0e002e6a..909ada1d6 100644
--- a/perllib/FixMyStreet/Map/WMTSBase.pm
+++ b/perllib/FixMyStreet/Map/WMTSBase.pm
@@ -241,7 +241,7 @@ sub latlon_to_tile($$$$) {
lon => $tile_params->{origin_x},
lat => $tile_params->{origin_y}
};
- my $res = $scales[$matrix_id] /
+ my $res = $scales[$zoom] /
($tile_params->{inches_per_unit} * $tile_params->{dpi});
# OpenLayers.INCHES_PER_UNIT[units] * OpenLayers.DOTS_PER_INCH
@@ -282,13 +282,12 @@ sub tile_to_latlon {
my ($self, $fx, $fy, $zoom) = @_;
my $tile_params = $self->tile_parameters;
- my $matrix_id = $zoom + $self->zoom_parameters->{id_offset};
my @scales = $self->scales;
my $tileOrigin = {
lon => $tile_params->{origin_x},
lat => $tile_params->{origin_y}
};
- my $res = $scales[$matrix_id] /
+ my $res = $scales[$zoom] /
($tile_params->{inches_per_unit} * $tile_params->{dpi});
# OpenLayers.INCHES_PER_UNIT[units] * OpenLayers.DOTS_PER_INCH
diff --git a/perllib/FixMyStreet/Map/Zurich.pm b/perllib/FixMyStreet/Map/Zurich.pm
index 3b97f947f..1e302bdda 100644
--- a/perllib/FixMyStreet/Map/Zurich.pm
+++ b/perllib/FixMyStreet/Map/Zurich.pm
@@ -13,7 +13,7 @@ sub zoom_parameters {
zoom_levels => scalar $self->scales,
default_zoom => 5,
min_zoom_level => 0,
- id_offset => 0,
+ id_offset => 2,
};
return $params;
}
@@ -29,7 +29,7 @@ sub tile_parameters {
wmts_version => '1.0.0',
layer_style => 'default',
matrix_set => 'default028mm',
- suffix => '', # appended to tile URLs
+ suffix => '.jpg', # appended to tile URLs
size => 512, # pixels
dpi => 96,
inches_per_unit => 39.3701, # BNG uses metres