diff options
author | Matthew Somerville <matthew@mysociety.org> | 2012-11-26 16:03:31 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2012-11-26 16:27:20 +0000 |
commit | 84d6ec9717c8e737dfdee0f04272a4cd955daae2 (patch) | |
tree | 70f9fccc296b770a9458b8f51f3b6242dc843a27 /web/js/map-wmts-zurich.js | |
parent | a6a42abed9dd134169d2db3d55de555951ca319f (diff) |
Simplify map bound transformation (should do bounds transform as might be skewed translation), fix transforms to modify original.
Diffstat (limited to 'web/js/map-wmts-zurich.js')
-rw-r--r-- | web/js/map-wmts-zurich.js | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/web/js/map-wmts-zurich.js b/web/js/map-wmts-zurich.js index 8723d557c..55f6f9dd2 100644 --- a/web/js/map-wmts-zurich.js +++ b/web/js/map-wmts-zurich.js @@ -10,7 +10,7 @@ function init_zurich_map(after) { fixmystreet.map = new OpenLayers.Map('map', { projection: new OpenLayers.Projection("EPSG:21781"), - displayProjection: new OpenLayers.Projection("EPSG:21781"), + displayProjection: new OpenLayers.Projection("EPSG:4326"), maxExtent: new OpenLayers.Bounds(676000,241000,690000,255000), units: 'm', scales: [ '250000', '125000', '64000', '32000', '16000', '8000', '4000', '2000', '1000', '500'], @@ -109,16 +109,9 @@ OpenLayers.Strategy.ZurichBBOX = OpenLayers.Class(OpenLayers.Strategy.BBOX, { } var swissBounds = this.layer.map.getExtent(); - - // Transform bound corners into WGS84 - note x/y arrangement of - // values from the current bounding box, it seems wrong but is not. - var topLeft = OpenLayers.Projection.CH1903.projectInverseSwiss( - {y: swissBounds.left, x: swissBounds.top} - ); - var bottomRight = OpenLayers.Projection.CH1903.projectInverseSwiss( - {y: swissBounds.right, x: swissBounds.bottom} - ); - return new OpenLayers.Bounds(topLeft.x, bottomRight.y, bottomRight.x, topLeft.y); + // Transform bound corners into WGS84 + swissBounds.transform( new OpenLayers.Projection("EPSG:21781"), new OpenLayers.Projection("EPSG:4326") ); + return swissBounds; }, CLASS_NAME: "OpenLayers.Strategy.ZurichBBOX" |