From d01e92d2c6822915a459024c26abb65fa3686311 Mon Sep 17 00:00:00 2001 From: peppecorra Date: Fri, 17 May 2013 14:06:07 +0300 Subject: [PATCH] Update imagelayer_wms.js A url does not always end with a ?, they may contains it [http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/Vettoriali/Batimetrica.map] --- source/core/layer/imagelayer_wms.js | 38 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/source/core/layer/imagelayer_wms.js b/source/core/layer/imagelayer_wms.js index 27b6d2ee..50358e47 100644 --- a/source/core/layer/imagelayer_wms.js +++ b/source/core/layer/imagelayer_wms.js @@ -64,34 +64,38 @@ function WMSImageLayer() //--------------------------------------------------------------------------- this.RequestTile = function(engine, quadcode, layer, cbfReady, cbfFailed, caller) { - if (this.server.indexOf("?", this.server.length - 1) == -1) - { - this.server+="?"; - } + var separator = "?"; + var index = this.server[0].indexOf("?"); + + if (index > 0 && index < (this.server[0].length - 1)) + { + separator = "&"; + } + var coords = new Array(4); if(this.SRS=="EPSG%3A4326") { this.quadtree.QuadKeyToWGS84(quadcode, coords); - var bbox= coords[0]+","+coords[1]+","+coords[2]+","+coords[3]; } else // EPSG:900913, ESRI:102100, ESRI:102113, EPSG:3785, EPSG:3857 { this.quadtree.QuadKeyToMercator(quadcode, coords); - var bbox= coords[0]+","+coords[1]+","+coords[2]+","+coords[3]; } + var bbox = coords.join(","); var sFilename = this.server + - "service=WMS"+ - "&request=GetMap" + - "&WIDTH=256" + - "&HEIGHT=256" + - "&TILED=TRUE" + - "&SRS=" + this.SRS + // deprecated -> EPSG%3A3857 - "&LAYERS=" + this.layer + - "&STYLES=" + this.style + - "&FORMAT="+ this.format + - "&VERSION=" + this.version + - "&BBOX=" + bbox; + separator + + "service=WMS"+ + "&request=GetMap" + + "&WIDTH=256" + + "&HEIGHT=256" + + "&TILED=TRUE" + + "&SRS=" + this.SRS + // deprecated -> EPSG%3A3857 + "&LAYERS=" + this.layer + + "&STYLES=" + this.style + + "&FORMAT="+ this.format + + "&VERSION=" + this.version + + "&BBOX=" + bbox;