method of refreshing 'live' tiles, e.g. traffic layer? #1206
-
I'm using FlutterMap with Google map tiles, and have included Google's ",traffic" option in the urlTemplate to get live traffic information. However, once an area has been displayed, the traffic information never seems to change - even closing the map page & re-opening it seems to re-load the previous data. Re-starting the app seems to be the only way! I assume this is a caching issue? Is there a way to clear the tile cache or force the tiles to re-load?
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hmm you could try changing the URL (add some irrelevant bogus arg to the end for example) with overrideTilesWhenUrlChanges: true... eg urlTemplate: "https://{s}.google.com/vt/lyrs=m,traffic&x={x}&y={y}&z={z}&refresh=${count}"; then increment count whenever you want an update ? Just thinking out loud, never tried it. |
Beta Was this translation helpful? Give feedback.
-
Just a note, it "may" be against Googles T&Cs to not use their own code to query their API, just make sure you cover yourself if it's part of a larger project that may get released. I may be out of date on this, just want anyone in future who reads to double check themselves. |
Beta Was this translation helpful? Give feedback.
-
You're welcome, and thanks for the feedback, may help others with a similar issue. |
Beta Was this translation helpful? Give feedback.
Hmm you could try changing the URL (add some irrelevant bogus arg to the end for example) with overrideTilesWhenUrlChanges: true...
eg urlTemplate: "https://{s}.google.com/vt/lyrs=m,traffic&x={x}&y={y}&z={z}&refresh=${count}";
then increment count whenever you want an update ?
Just thinking out loud, never tried it.