[GIS] Rendering geoJson polygons in google maps android apiv2

androidgoogle mapsgoogle-maps-apipostgis

I'm in the process of publishing spatial data stored in a PostGIS database to a Google Maps based android app and am trying to put together a plan for rendering my data in the most efficient manner possible.

The portion of my dataset I'm concerned about consists of about 200,000 polygons that will be filtered by the user name, bounding box etc. I can see situations where I would like to display up to 1000 heavily simplified polygons when zoomed out, but I doubt that I will be displaying more than 20 on a screen without simplifying the data.

My current strategy is to query my database based on the filtering factors mentioned above, return the query as a GeoJSON and render the resulting data directly into Google Maps.

Is this an appropriate strategy or should I be looking at using another service to help render my data before it is loaded into Google Maps?

If it is an appropriate strategy I could use some advice on how to render GeoJSON polygons in the Google Maps android api.

I'm quite comfortable with the SQL end of this project but I'm not as experienced with JavaScript or the Google Maps android api v2.

Best Answer

I'm not familiar with the Android development environment, but I think I may have a solution. If you export your geometr(ies), 200,000 polygons, say, in Well-Known Text (WKT) format, you can use the open-source library Wicket to directly create Polygon() objects in Google Maps API. Here's a demo:

http://arthur-e.github.io/Wicket/sandbox-gmaps3.html

WKT is the base text representation of geometry in PostGIS. You can get the WKT representation of any geometry or geography type data in PostGIS using the ST_AsText() function.