-
Notifications
You must be signed in to change notification settings - Fork 103
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
Adding GeoJSON Layer in onMapCreated is unreliable #568
Comments
@marcellangmaier does this happen only on Android on your side or also on iOS? I have similar problems using the latest mapbox plugin (v. 2.0.0), but only on Android. I am trying to load a custom json style inside the onMapCreated handler.
I can see the log-message in the console, so the onMapCreated handler is executed, but the map is still showing the default style. In addition, when adding a geojson source and a layer inside the onStyleLoadedListener like this:,
then the layer is visible (on the default map style instead of the custom json style that is not getting loaded correctly), but I also get an exception on Android.
Everything was working correctly with plugin version 1.1.0 on Android and iOS, and with version 2.0.0 it is still working on iOS, but NOT on Android. |
I do have a similiar problem after upgrading to 2.0.0 on android. With 1.1.0 everything worked fine. In my onMapCreated i add a terrain Source:
and I got an error:
|
For reliable results, use |
@evil159 as I mentioned above, I still have similar issues on Android after upgrading to 2.0,0, even when adding sources and layers in onStyleLoaded. |
@felixkrautschuk It appears you have another issue, you are trying to add a source that already exists |
When I add a GeoJSON Layer in onMapCreated, sometimes it gets displayed, sometimes not.
https://github.com/mapbox/mapbox-maps-flutter/assets/26068556/0027f248-5a57-46d8-ad06-332f4a6fa58e
https://github.com/mapbox/mapbox-maps-flutter/assets/26068556/856634f2-d741-45c4-85f5-178b61050aa1
pubspec.yaml: mapbox_maps_flutter: ^2.0.0-rc.1
My _onMapCreated method:
The method which adds the geojson layer
Simple example:
main.dart.zip
GeoJson file:
line.geojson.zip
The text was updated successfully, but these errors were encountered: