-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refreshing a reprojected XYZ source not working #11326
Comments
Your example works for me when I click the 'open in new window' button. |
???? Sorry, i didn't understand your reply or maybe I haven't explained the issue properly. The issue here is that the XYZ source is not refreshed invoking the source.refresh() function called by the button. You can see a "flashing" effect but is you are looking at the network monitor tiles aren't re-downloaded. This feature was working in 5.X. From the doc https://openlayers.org/en/latest/apidoc/module-ol_source_Source-Source.html#refresh Refreshes the source. The source will be cleared, and data from the server will be reloaded. |
The tiles you want to refresh are in the browser cache. This is why no new requests are sent. Click "Disable cache" in your developer tools and try again. Then you'll see that the tiles are requested again. |
Ok maybe i've used the wrong example to show the issue. I'm writing a new codepen example. I'm coming back with the new example |
Sorry for the delay, when i was trying to write a complete example I notice that projections was declared only on sources and not on the main view. By declaring the right projection when initializing the view everything works. This wasn't necessary in 5.X but anyway now is working |
I think it is still worth investigating this further. If your sources have a different projection than your view, they will be reprojected to the view projection. If you specify the same projection in the view, the source will be used directly. So what you are experiencing might be a problem with reprojected layers. |
Ok, anyway if could be useful here the example https://codesandbox.io/s/refresh2-yejq9?file=/main.js |
If you specify a custom projection for the layers and use the default projection for the view you would need to define transforms or a proj4 definition for the custom projection. With everything using the custom projection that isn't necessary. You could also reduce your
|
Sorry for the messy code but i had to rewrite the entire example since i'm using OL via GWT. In any case i will try your hint, thanks! |
I was now able to verify that this only happens on reprojected sources. It is not a regression, it never worked. Here is a codesandbox to reproduce the issue: https://codesandbox.io/s/purple-meadow-dws3l?file=/main.js. Open the console in the codesandbox to see what is going on. When the |
Hello everyone,
Seems that refreshing a XYZ source (when e.g. some params are changing and we want to refresh the map) is not working anymore.
Here a small example, https://codesandbox.io/s/ol-xyzsource-dx2g0?file=/main.js
As you can see by the network monitor, by clicking the "refresh xyz source" button the source is not refreshed since the monitor does not report any network activity.
The text was updated successfully, but these errors were encountered: