-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Usage question: How to refresh map using layer with custom data? #4446
Comments
The iOS SDK doesn’t currently have an API for refreshing the map. The OS X SDK’s MGLMapView has a
|
Can you explain a bit more what you mean by "works by setting the style URL to a bogus value then back to the original URL. But that hits the cache instead of clearing it" Are you saying that if I set the style to something then switch it back that it would not clear the cache? Or is that a possible workaround I can use. |
I’m not sure how reliable it is as a workaround. The osxapp demo app uses it solely for the purpose of forcing a reload after an access token change. But in your case, it sounds like you want the same style URL and the same sources to reload. Perhaps you could add a timestamp to the style URL to evade the cache with respect to the style, but I suspect that the vector tiles themselves would still hit the cache. |
@1ec5 The in-memory cache is per Source. So if the client generates a style where in the source name for the traffic data is changed, it should ensure that the in-memory cache is not hit. For cache busting timestamp parameter, you probably meant tile url template (and not the style url). |
@picciano It's not the style you need refreshed, it's the vector tiles or GeoJSON containing the data correct? For all resources including vector tiles and GeoJSON resources, Mapbox GL obeys standard HTTP cache headers. If you serve your tiles with |
We are using custom data hosted by Mapbox for this.
|
|
Any progress on this? I have the exact same requirements but on Android |
Tiles which refresh every five minutes should be served with |
We have created a custom map style that include traffic data displayed on the map. The data is refreshed every five minutes or so, but how do we get the map to reflect those changes? Is there a way to force the cache to be cleared and the map tiles reloaded or redrawn from the updated data?
Thanks much!
Tony
The text was updated successfully, but these errors were encountered: