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
How to switch map layers #629
Comments
I had the same requirement/issue yesterday and while I know my solution is not optimal in ANY way, it solved the problem for now: Add the two TileLayerOptions every time but set (I'm still looking for a way to "force redraw" the entire map at once and not just moving it.) |
Looks like something might be coming soon: #619 |
Can't you programmatically include just the required map url and do a move() or whatever into your layers list? Not quite sure I follow why you need both loaded in a layer, and not just the one that's switched to ? |
I'm my case I need the map layers to update instantly (switching between light/dark mode) without user to having move the map to get the tiles from the selected layer. I will try to use |
The same thing happens to me, I have not found a solution to the problem. |
Looks great! @johnpryan It would be great to get this merged! |
I could not fix the error |
@dariomadeira what happens if you use |
@maRci002 I don't understand how to fix the error, in my pubspec.yaml I have: and my code is:
the result: I am new to Flutter, sorry for my English and thank you very much! |
@dariomadeira I see the problem now. I haven't checked Till use this as workaround: urlTemplate : "https://api.mapbox.com/styles/v1/mapbox/$tipoMapa/tiles/{z}/{x}/{y}?access_token={accessToken}" ,
additionalOptions: {
'accessToken': '<MyToken>',
} |
@maRci002 |
@maRci002 Thanks for implementing this. I'm now using 381afd0 and it works great to have the map refreshed when changing the map with a different If I use 0.9.0 I can toggle the marker layer without the map being reloaded. |
Dear @maRci002 I've tried to fix that here #740 . Can you take a look into that MR and give feedback if that's correct? |
Hi,
I have two map layers: OSM and MapBox Satellite:
Is there a way to add a layer switch to switch between both layers?
As workaround I tried to add a button with
setState()
inonPressed()
. However, althought thebuild()
is called, the underlying map is not changing:Any help is appreciated :) Thanks in advance!
Edit: It seems that the layer changes. When I pan or zoom, the switch layer is shown. So, I need a way to refresh the currently shown tiles anyway...
The text was updated successfully, but these errors were encountered: