Thursday 22 October 2020

Efficient way to add large GeoJson to GoogleMap on Android

I have a temperature map for some area with 3 km grid. I.e. I have about few thousands of polygons with color.

I'm trying to show them on Google Map on android in my kotlin application.

The issue is that I need to add GeoJson layer in UI thread and it takes 8-15 seconds. I.e. all this time the application is frozen

There are a lot of old answers on StackOverflow about this issue but they all are not relevant for me:

  1. They propose to decrease the json - I already create clusters from nearby squares with the same value
  2. They propose to use MapView and overlays - but in the latest google map API there is no MapView and ability to add overlays in background thread

I tried:

  1. map.addPolygon instead of creation of a GeoJsonLayer
  2. map addOverlay with GroundOverlay

Still I have more or less the same time when UI is frozen

How can I manage this issue? Is there any way to create a map from thousands of colorful rectangles in a background thread and then show it immediately in UI thread?



from Efficient way to add large GeoJson to GoogleMap on Android

No comments:

Post a Comment