ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
680 stars 227 forks source link

Updating WMS url breaks createTileUrlFunction #357

Closed scadergit closed 3 years ago

scadergit commented 3 years ago

Here is a working example. Click the link to update the station which change the url of the WMS source. https://codesandbox.io/s/relaxed-wright-m2h87

After issue https://github.com/ghettovoice/vuelayers/issues/248 was resolved, the javascript error is gone, but changing the url now causes invalid urls to be sent to the geospacial service. The url is missing all the parameters needed for the service.

An example before changing the source url: https://opengeo.ncep.noaa.gov/geoserver/krax/ows?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=krax_bref_raw&WIDTH=256&HEIGHT=256&CRS=EPSG%3A3857&BBOX=-10018754.171394622%2C5009377.085697312%2C-8766409.899970295%2C6261721.35712164

An example after changing the source url: https://opengeo.ncep.noaa.gov/geoserver/kakq/ows

This does not impact initial load because the watch in tile-source.js for urlFunc does not trigger immediately. When the watch does trigger on change of this.url, the call to setTileUrlFunction results in requests that no longer include parameters.

scadergit commented 3 years ago

Note that you might not see the radar on the map even before click if there is no rain near DC. If you click the link to change stations you'll still see the invalid requests in the developer tools Network tab.

ghettovoice commented 3 years ago

Hello @scadergit , thanks for report.

I need some time to publish patch...

scadergit commented 3 years ago

Thanks, appreciate your effort on this library. It is being used in the new version of the National Weather Service radar application (preview at: https://preview-radar.weather.gov).

ghettovoice commented 3 years ago

@scadergit upgrade pls. It should now work correctly.

It is being used in the new version of the National Weather Service radar

nice 👍

scadergit commented 3 years ago

Works great, thanks for the quick fix.