Open noforeignland opened 7 months ago
Hi @noforeignland --
Thanks for sharing this report -- we will investigate on our side.
There are a few different approaches to adding annotations/markers, so I want to make sure you are using the best approach for your needs. Can you share a bit more information about your use case and how you are creating the annotations? Is the data for these annotations stored in a GeoJSON or some other format?
We are trying to migrate from mapbox_gl to flutter_mapbox_maps. Currently our app pushes about 70K GeoJson markers onto the mapbox map. It seems to handle it very easily.
Using the new PointAnnotationOptions interface in flutter_mapbox_maps has two main problems:
1) There's a pretty low limit on how many markers can be added before an OOM error is thrown and the app dies. 2) When the user taps on a marker, the ID that is provided is a GUID that cannot be overidden, makgin it impossible for us to tell which feature was tapped on on the map.
We have been trying out adding a GeoJson source directly but this also has problems:
1) It's slow to refresh the markers 2) There is no way of changing the data source once it's set - an exception is thrown when changes are made 3) The onTap event does not indicate which feature is tapped on and the coordinates provided do not return results when queried. See my post in Discord for more details.
Hi,
Point annotations aren't suitable for such a large amount of annotations, we don't recommend using them for more than 250 annotations.
For your number of annotations, Style Layers with GeoJson sources are the recommended way. Regarding the limitations you have found, 1 & 2 are valid. In the native SDK we introduced partial GeoJSON updates to address them, but this API is not exposed in Flutter. We'll plan it for one of the upcoming releases. For 3, you should be able to get an id of a feature from the identifier
property.
In the demo application, increasing the loop size in the PointAnnotationPage to 10K markers:
causes the demo application to crash with the following OOM error:
Expected bahaviour:
The application should be able to cope with tens of thousands of markers, not just a small number. Our production app uses Flutter mapbox_gl and manages in excess of 70K markers simultaneously.