We have developed an android application which loads different eco-zones and does geo-fencing based on current GPS location.

We have converted a shapefile to KML, then to JSON format, for loading in the Android app.

The zones had 1000+ vertexes, so performance was an issue. I then tried splitting the polygons, this deforms zone boundaries.

Is there a better approach to this, while respecting zone boundaries, in which the performance could be improved? I.e. less vertices using some other algorithm? or a better GIS data format ?


I'm not sure about your exact workflow, so I'll try to give a general answer.

There are two different ways that geodata can be used, and the answer depends on which one you need:

  1. You are showing the data on a map. In this case, if you load 1000+ vertices as graphics on the map, you will have a low performance. What you need to do is to load the data as a raster, say a WMS service or something similar. Delegate the drawing of the layer to something else. How to implement this, depends on you map View. I am not too sure of Google Map API, But you could look into using the osmdroid library.

  2. Your app has the data, but it is used only for querying. Say for example, finding out if the current location is within a zone or not. This can be done by storing the data in a spatial database. We have had a lot of success with spatilite for Android

You could also go for a hybrid aproach if you need both.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.