mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
475 stars 133 forks source link

Loading large geojson files #2006

Closed gilgil28 closed 1 year ago

gilgil28 commented 1 year ago

I am downloading large geojson files (>10K features) and I am loading them into my map. What is the correct way of doing this? On version 10.11.0 you added some kind of performance improvement (https://github.com/mapbox/mapbox-maps-android/pull/1920). could you elaborate on that? Also, is it possible to stream data into mapbox for loading data on the go?

ank27 commented 1 year ago

What is the correct way of doing this? On version 10.11.0 you added some kind of performance improvement (https://github.com/mapbox/mapbox-maps-android/pull/1920). could you elaborate on that?

Yes, we did geojson data performance improvement in v10.11.0, could you try with latest version. Earlier json was converted to string before processing, now its possible to process the Geojson as it is. this improved the performance. Thank you :)

gilgil28 commented 1 year ago

What is the correct way of doing this? On version 10.11.0 you added some kind of performance improvement (#1920). could you elaborate on that?

Yes, we did geojson data performance improvement in v10.11.0, could you try with latest version. Earlier json was converted to string before processing, now its possible to process the Geojson as it is. this improved the performance. Thank you :)

can you show an example code of loading a geojson file?

kiryldz commented 1 year ago

Also, is it possible to stream data into mapbox for loading data on the go?

Not sure I follow but guess answer is no - if using geojson, you need to update data explicitly using one of the following functions: data(), feature(), featureCollection(), geometry()

can you show an example code of loading a geojson file?

https://github.com/mapbox/mapbox-maps-android/blob/main/app/src/main/java/com/mapbox/maps/testapp/examples/LargeGeojsonPerformanceActivity.kt showcases how to load pretty big files from assets, in your case it will be file. Performance is indeed improved in v10.11 but I'd suggest using v10.12 as it contains couple bug fixes.