Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 apiv2.

Thank you for the help.

share|improve this question
    
Have you considered the user experience side of things - does the user really need to see up to 1,000 polygons on a single view, or would 100-200 suffice? –  minus34 Feb 19 at 3:20
add comment

2 Answers

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.

share|improve this answer
add comment

Provided you've thinned the polygons appropriately and trimmed the unneeded decimal places by formatting the coordinates output from PostGIS, then geoJSON is as good as it gets for a straightforward solution.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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