Take the 2-minute tour ×

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 ?

share|improve this question
You can generalise (simplification) the polygons lightly or aggressively - see gis.stackexchange.com/questions/440/… –  Mapperz Feb 13 '13 at 3:07
If the shapefile was loaded into a spatial database (ie postgis) you can request both json (geojson) and simplified polygons on the fly postgis.org/docs/ST_AsGeoJSON.html postgis.org/docs/ST_Simplify.html –  Mapperz Feb 13 '13 at 3:11

1 Answer 1

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.

share|improve this answer

Your Answer


