Skip to content

Commit

Permalink
Tweak WMTS JavaScript to match merged branch.
Browse files Browse the repository at this point in the history
Use $.each rather than .forEach.
  • Loading branch information
dracos committed Jul 11, 2016
1 parent 74ce84b commit 01105c9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
17 changes: 7 additions & 10 deletions web/js/map-wmts-base.js
@@ -1,29 +1,29 @@
// Functionality required by all OpenLayers WMTS base maps

function setup_wmts_base_map() {
fixmystreet.maps.setup_wmts_base_map = function() {
fixmystreet.map_type = OpenLayers.Layer.WMTS;

// Set DPI - default is 72
OpenLayers.DOTS_PER_INCH = fixmystreet.wmts_config.tile_dpi;

fixmystreet.map_options = {
maxExtent: layer_bounds,
maxExtent: this.layer_bounds,
units: 'm',
scales: fixmystreet.wmts_config.scales
};

fixmystreet.layer_options = [];
fixmystreet.wmts_config.layer_names.forEach(function(v, i) {
$.each(fixmystreet.wmts_config.layer_names, function(i, v) {
fixmystreet.layer_options.push({
projection: new OpenLayers.Projection(fixmystreet.wmts_config.map_projection),
name: fixmystreet.wmts_config.layer_names[i],
layer: fixmystreet.wmts_config.layer_names[i],
name: v,
layer: v,
formatSuffix: fixmystreet.wmts_config.tile_suffix.replace(".", ""),
matrixSet: fixmystreet.wmts_config.matrix_set,
requestEncoding: "REST",
url: fixmystreet.wmts_config.tile_urls[i],
style: fixmystreet.wmts_config.layer_style,
matrixIds: matrix_ids,
matrixIds: fixmystreet.maps.matrix_ids,
tileOrigin: new OpenLayers.LonLat(fixmystreet.wmts_config.origin_x, fixmystreet.wmts_config.origin_y)
});
});
Expand All @@ -33,7 +33,7 @@ function setup_wmts_base_map() {
fixmystreet.bbox_strategy = new OpenLayers.Strategy.ReprojectBBOX({
ratio: 1
});
}
};

OpenLayers.Strategy.ReprojectBBOX = OpenLayers.Class(OpenLayers.Strategy.BBOX, {
getMapBounds: function() {
Expand All @@ -51,6 +51,3 @@ OpenLayers.Strategy.ReprojectBBOX = OpenLayers.Class(OpenLayers.Strategy.BBOX, {

CLASS_NAME: "OpenLayers.Strategy.ReprojectBBOX"
});


//
6 changes: 3 additions & 3 deletions web/js/map-wmts-bristol.js
Expand Up @@ -3,13 +3,13 @@
*/

// From the 'fullExtent' key from http://maps.bristol.gov.uk/arcgis/rest/services/base/2015_BCC_96dpi/MapServer?f=pjson
var layer_bounds = new OpenLayers.Bounds(
fixmystreet.maps.layer_bounds = new OpenLayers.Bounds(
268756.31099999975, // W
98527.70309999958, // S
385799.51099999994, // E
202566.10309999995); // N

var matrix_ids = [
fixmystreet.maps.matrix_ids = [
{
"identifier": "0",
"supportedCRS": "urn:ogc:def:crs:EPSG::27700",
Expand Down Expand Up @@ -119,7 +119,7 @@ fixmystreet.maps.config = function() {
fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
}

setup_wmts_base_map();
this.setup_wmts_base_map();
};

fixmystreet.maps.marker_size_for_zoom = function(zoom) {
Expand Down
6 changes: 3 additions & 3 deletions web/js/map-wmts-zurich.js
Expand Up @@ -3,13 +3,13 @@
*/

// From 'fullExtent' from http://www.gis.stadt-zuerich.ch/maps/rest/services/tiled95/LuftbildHybrid/MapServer?f=pjson
var layer_bounds = new OpenLayers.Bounds(
fixmystreet.maps.layer_bounds = new OpenLayers.Bounds(
2676000.9069999997, // W
1241399.842, // S
2689900.9069999997, // E
1254599.842); // N

var matrix_ids = [
fixmystreet.maps.matrix_ids = [
// The two highest zoom levels are pretty much useless so they're disabled.
// {
// "matrixHeight": 882,
Expand Down Expand Up @@ -184,7 +184,7 @@ fixmystreet.maps.config = function() {
fixmystreet.controls.push( new OpenLayers.Control.PermalinkFMS('key-tool-problems-nearby', '/around') );
}

setup_wmts_base_map();
this.setup_wmts_base_map();

fixmystreet.area_format = { fillColor: 'none', strokeWidth: 4, strokeColor: 'black' };
};
Expand Down

0 comments on commit 01105c9

Please sign in to comment.