Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying KML Layers on Maps at Native Android apps Best Practice

I have big KML file to a native Android application, please check the following details and give an advice.

KML file details:

  • size: 1.7 MB
  • total number of kml file elements: 500 elements
  • total number of polygon: 1000 polygon

Android app details:

  • the above details will be viewed in Fragment
  • I used the following support library to implement this screen compile 'com.google.maps.android:android-maps-utils:0.4+'
  • some caluctations are done on loading the screens(like distance calculations)

Issue:

  • Take a lot of time to load the map and kml layer about 8 sec create KMLLayer instance

What is the best practice to implement the above details with good performance?

please advise.

like image 521
Wael Abo-Aishah Avatar asked Mar 02 '17 10:03

Wael Abo-Aishah


People also ask

Can Google Maps display KML?

Open Google My Maps. Create a new map. Press import. Open your KML file or drag your KML file into the import window.

Can you import KML file into Google Maps Android?

You can import map features like lines, shapes, and places to your map from KML files, spreadsheets and other files.

What's the difference between KMZ and KML?

KML can include both raster and vector data, and the file includes symbolization. KML files are like HTML, and only contains links to icons and raster layers. A KMZ file combines the images with the KML into a single zipped file.


1 Answers

Best practice is doing long time operation in background (for example, on separate thread) and split complex tasks into small parts. So you can:

1) create and start load KML layer as soon as possible (e.g. on app create) and than just show it;

2) instead of one kml file with 500 elements and 1000 polygons, use 50 kml files with 10 elements and 100 polygons and load to layer only necessary files (for example you can split it by area location, or by semantic information, or by something else criteria);

3) combine 1 and 2 points;

4) precisely for google maps it's possible to create tiles with information from kml files and use TileProvider.

like image 109
Andrii Omelchenko Avatar answered Oct 24 '22 14:10

Andrii Omelchenko