diff --git a/ckanext/geoview/public/js/ol2_preview.js b/ckanext/geoview/public/js/ol2_preview.js index d7dd4b97..1674fca8 100644 --- a/ckanext/geoview/public/js/ol2_preview.js +++ b/ckanext/geoview/public/js/ol2_preview.js @@ -129,20 +129,29 @@ }, 'wfs': function(resource, proxyUrl, proxyServiceUrl, layerProcessor) { var parsedUrl = resource.url.split('#'); - var url = proxyServiceUrl || parsedUrl[0]; - + var simpleUrl = parsedUrl[0].split('?'); + var directUrl = simpleUrl[0].toString(); // Without query + var keepArgs = simpleUrl.length > 1 && reduceWMSWFSArguments(simpleUrl[1]); + if (keepArgs) { + if (proxyServiceUrl) proxyServiceUrl += keepArgs; + directUrl += keepArgs; + } + var url = proxyServiceUrl || directUrl; var ftName = parsedUrl.length > 1 && parsedUrl[1]; OL_HELPERS.withFeatureTypesLayers(url, layerProcessor, ftName); }, 'wms' : function(resource, proxyUrl, proxyServiceUrl, layerProcessor) { var parsedUrl = resource.url.split('#'); - // use the original URL for the getMap, as there's no need for a proxy for image requests - var getMapUrl = parsedUrl[0].split('?')[0]; // remove query if any - - var url = proxyServiceUrl || getMapUrl; - + var simpleUrl = parsedUrl[0].split('?'); + var directUrl = simpleUrl[0]; // Without query and using the original URL for the getMap, as there's no need for a proxy for image requests + var keepArgs = simpleUrl.length > 1 && reduceWMSWFSArguments(simpleUrl[1]); + if (keepArgs) { + if (proxyServiceUrl) proxyServiceUrl += keepArgs; + directUrl += keepArgs; + } + var url = proxyServiceUrl || directUrl; var layerName = parsedUrl.length > 1 && parsedUrl[1]; - OL_HELPERS.withWMSLayers(url, getMapUrl, layerProcessor, layerName); + OL_HELPERS.withWMSLayers(url, directUrl, layerProcessor, layerName); }, 'esrigeojson': function (resource, proxyUrl, proxyServiceUrl, layerProcessor) { var url = proxyUrl || resource.url; @@ -161,6 +170,18 @@ layerProcessor(OL_HELPERS.createGFTLayer(tableId, ckan.geoview.gapi_key)); } } + + var reduceWMSWFSArguments = function(input) { + var args = input.split('&'); + output = '?'; + for (i=0;i