aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Map/Bristol.pm50
-rw-r--r--perllib/FixMyStreet/Map/Buckinghamshire.pm40
-rw-r--r--perllib/FixMyStreet/Map/UKCouncilWMTS.pm50
3 files changed, 92 insertions, 48 deletions
diff --git a/perllib/FixMyStreet/Map/Bristol.pm b/perllib/FixMyStreet/Map/Bristol.pm
index 99bdd26d7..e32026ee4 100644
--- a/perllib/FixMyStreet/Map/Bristol.pm
+++ b/perllib/FixMyStreet/Map/Bristol.pm
@@ -2,39 +2,15 @@
# Bristol use their own tiles on their cobrand
package FixMyStreet::Map::Bristol;
-use base 'FixMyStreet::Map::WMTSBase';
+use base 'FixMyStreet::Map::UKCouncilWMTS';
use strict;
-sub zoom_parameters {
- my $self = shift;
- my $params = {
- zoom_levels => scalar $self->scales,
- default_zoom => 5,
- min_zoom_level => 0,
- id_offset => 0,
- };
- return $params;
-}
+sub default_zoom { 5; }
-sub tile_parameters {
- my $self = shift;
- my $params = {
- urls => [ 'https://maps.bristol.gov.uk/arcgis/rest/services/base/2015_BCC_96dpi/MapServer/WMTS/tile' ],
- layer_names => [ '2015_BCC_96dpi' ],
- wmts_version => '1.0.0',
- layer_style => 'default',
- matrix_set => 'default028mm',
- suffix => '.png', # appended to tile URLs
- size => 256, # pixels
- dpi => 96,
- inches_per_unit => 39.3701, # BNG uses metres
- projection => 'EPSG:27700',
- origin_x => -5220400.0,
- origin_y => 4470200.0,
- };
- return $params;
-}
+sub urls { [ 'https://maps.bristol.gov.uk/arcgis/rest/services/base/2015_BCC_96dpi/MapServer/WMTS/tile' ] }
+
+sub layer_names { [ '2015_BCC_96dpi' ] }
sub scales {
my $self = shift;
@@ -59,7 +35,7 @@ sub copyright {
sub map_template { 'bristol' }
sub map_javascript { [
- '/vendor/OpenLayers/OpenLayers.bristol.js',
+ '/vendor/OpenLayers/OpenLayers.wmts.js',
'/js/map-OpenLayers.js',
'/js/map-wmts-base.js',
'/js/map-wmts-bristol.js',
@@ -67,18 +43,4 @@ sub map_javascript { [
'/cobrands/bristol/assets.js',
] }
-# Reproject a WGS84 lat/lon into BNG easting/northing
-sub reproject_from_latlon($$$) {
- my ($self, $lat, $lon) = @_;
- my ($x, $y) = Utils::convert_latlon_to_en($lat, $lon);
- return ($x, $y);
-}
-
-# Reproject a BNG easting/northing into WGS84 lat/lon
-sub reproject_to_latlon($$$) {
- my ($self, $x, $y) = @_;
- my ($lat, $lon) = Utils::convert_en_to_latlon($x, $y);
- return ($lat, $lon);
-}
-
1;
diff --git a/perllib/FixMyStreet/Map/Buckinghamshire.pm b/perllib/FixMyStreet/Map/Buckinghamshire.pm
index 10ee2a080..0e1a7f493 100644
--- a/perllib/FixMyStreet/Map/Buckinghamshire.pm
+++ b/perllib/FixMyStreet/Map/Buckinghamshire.pm
@@ -2,17 +2,49 @@
# More JavaScript, for street assets
package FixMyStreet::Map::Buckinghamshire;
-use base 'FixMyStreet::Map::OSM';
+use base 'FixMyStreet::Map::UKCouncilWMTS';
use strict;
+sub default_zoom { 8; }
+
+sub urls { [ 'https://maps.buckscc.gov.uk/arcgis/rest/services/Basemapping2018/MapServer/WMTS/tile' ] }
+
+sub layer_names{ [ 'Basemapping2018' ] }
+
+sub scales {
+ my $self = shift;
+ my @scales = (
+ '1000000',
+ '500000',
+ '250000',
+ '125000',
+ '64000',
+ '32000',
+ '16000',
+ '8000',
+ '4000',
+ '2000',
+ '1000',
+ );
+ return @scales;
+
+}
+
+sub copyright {
+ return '© BCC';
+}
+
+sub map_template { 'buckinghamshire' }
+
sub map_javascript { [
- '/vendor/OpenLayers/OpenLayers.wfs.js',
+ '/vendor/OpenLayers/OpenLayers.wmts.js',
'/vendor/OpenLayers.Projection.OrdnanceSurvey.js',
'/js/map-OpenLayers.js',
- '/js/map-OpenStreetMap.js',
- '/cobrands/fixmystreet-uk-councils/roadworks.js',
+ '/js/map-wmts-base.js',
+ '/js/map-wmts-buckinghamshire.js',
'/cobrands/fixmystreet/assets.js',
+ '/cobrands/fixmystreet-uk-councils/roadworks.js',
'/cobrands/buckinghamshire/js.js',
'/cobrands/buckinghamshire/assets.js',
] }
diff --git a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm
new file mode 100644
index 000000000..c1a729f85
--- /dev/null
+++ b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm
@@ -0,0 +1,50 @@
+package FixMyStreet::Map::UKCouncilWMTS;
+use base 'FixMyStreet::Map::WMTSBase';
+
+use strict;
+
+sub zoom_parameters {
+ my $self = shift;
+ my $params = {
+ zoom_levels => scalar $self->scales,
+ default_zoom => $self->default_zoom,
+ min_zoom_level => 0,
+ id_offset => 0,
+ };
+ return $params;
+}
+
+sub tile_parameters {
+ my $self = shift;
+ my $params = {
+ urls => $self->urls,
+ layer_names => $self->layer_names,
+ wmts_version => '1.0.0',
+ layer_style => 'default',
+ matrix_set => 'default028mm',
+ suffix => '.png', # appended to tile URLs
+ size => 256, # pixels
+ dpi => 96,
+ inches_per_unit => 39.3701, # BNG uses metres
+ projection => 'EPSG:27700',
+ origin_x => -5220400.0,
+ origin_y => 4470200.0,
+ };
+ return $params;
+}
+
+# Reproject a WGS84 lat/lon into BNG easting/northing
+sub reproject_from_latlon($$$) {
+ my ($self, $lat, $lon) = @_;
+ my ($x, $y) = Utils::convert_latlon_to_en($lat, $lon);
+ return ($x, $y);
+}
+
+# Reproject a BNG easting/northing into WGS84 lat/lon
+sub reproject_to_latlon($$$) {
+ my ($self, $x, $y) = @_;
+ my ($lat, $lon) = Utils::convert_en_to_latlon($x, $y);
+ return ($lat, $lon);
+}
+
+1;