diff --git a/examples/layer/map.wmscapabilities.html b/examples/layer/map.wmscapabilities.html index 68fc4195..ac3c9e63 100644 --- a/examples/layer/map.wmscapabilities.html +++ b/examples/layer/map.wmscapabilities.html @@ -109,7 +109,7 @@

ol-ext: WMS Capabilities control

target: document.body, srs: ['EPSG:2154'], cors: true, - optional: 'token', + optional: 'token,apikey', services: { 'BRGM': 'https://geoservices.brgm.fr/geologie', 'OSM': 'https://wms.openstreetmap.fr/wms', diff --git a/examples/routing/map.control.isochrone.html b/examples/routing/map.control.isochrone.html index a90aee1f..6301ccc9 100644 --- a/examples/routing/map.control.isochrone.html +++ b/examples/routing/map.control.isochrone.html @@ -115,8 +115,8 @@

ol-ext: Geoportail isochrone

search.on('isochrone', function(iso) { if (!batch.length && iso.iteration === 0) vector.getSource().clear(); + // Simplify using closing operation with jsts if (Number($('.simplify').val())) { - // Simplify using closing operation with jsts var simpli = Number($('.simplify').val()); var parser = new jsts.io.OL3Parser(); var geom = iso.feature.getGeometry(); @@ -126,6 +126,7 @@

ol-ext: Geoportail isochrone

buffered = jsts.simplify.DouglasPeuckerSimplifier.simplify(buffered, Math.min(10, simpli/10)) iso.feature.setGeometry(parser.write(buffered)); } + console.log(currentFeature) vector.getSource().addFeature(iso.feature); setTimeout(function() { map.getView().fit(vector.getSource().getExtent(), { duration:1000 }); @@ -147,10 +148,12 @@

ol-ext: Geoportail isochrone

/* BATCH mode: load a geojson file */ var batch = []; var current_iteration = 0; + var currentFeature = null; var dialog = new ol.control.Dialog(); map.addControl(dialog); function dosearch() { + currentFeature = null; if (!batch.length) { dialog.hide(); return; @@ -166,6 +169,7 @@

ol-ext: Geoportail isochrone

var pt = batch[0].getGeometry().getFirstCoordinate(); var val = search.get('method')==='distance' ? search.get('distance')*1000 : (search.get('hour')||0)*60*60+(search.get('minute')||0)*60; if (val) { + currentFeature = batch[0]; search.search(pt, val, current_iteration-1) } else { batch = []; @@ -182,6 +186,12 @@

ol-ext: Geoportail isochrone

current_iteration = search.get('iter')+1; dosearch(); }); + + // Restart after error + function reRun() { + current_iteration++; + dosearch(); + } diff --git a/src/control/WMSCapabilities.js b/src/control/WMSCapabilities.js index be83177a..940b5d2a 100644 --- a/src/control/WMSCapabilities.js +++ b/src/control/WMSCapabilities.js @@ -471,6 +471,7 @@ var ol_control_WMSCapabilities = class olcontrolWMSCapabilities extends ol_contr } }.bind(this)) } + this._optional = optional; // Get request params var request = this.getRequestParam(options) @@ -727,6 +728,8 @@ var ol_control_WMSCapabilities = class olcontrolWMSCapabilities extends ol_contr } } + Object.keys(this._optional).forEach(o => source_opt.params[o] = this._optional[o]) + // Resolution to zoom var view = new ol_View({ projection: this.getMap().getView().getProjection() @@ -834,8 +837,11 @@ var ol_control_WMSCapabilities = class olcontrolWMSCapabilities extends ol_contr title: this._elements.formTitle.value } } - if (this._elements.formMap.value) + + Object.keys(this._optional).forEach(o => options.source.params[o] = this._optional[o]) + if (this._elements.formMap.value) { options.source.params.MAP = this._elements.formMap.value + } return options } /** Fill dialog form diff --git a/src/control/WMTSCapabilities.js b/src/control/WMTSCapabilities.js index f10c5b2b..d70ba232 100644 --- a/src/control/WMTSCapabilities.js +++ b/src/control/WMTSCapabilities.js @@ -110,6 +110,8 @@ var ol_control_WMTSCapabilities = class olcontrolWMTSCapabilities extends ol_con * @returns {boolean} */ isSupportedSet(tm) { + console.log(tm) + if (/^PM_.*/.test(tm.TileMatrixSet)) return true; return this.supportedSets.indexOf(tm.TileMatrixSet) >= 0; } /** Return a WMTS options for the given capabilities