[postgis-users] Postgis Polygon to Google Maps Polygon

Bborie Park bkpark at ucdavis.edu
Tue Feb 14 15:59:25 PST 2012



On 02/14/2012 03:43 PM, Jeremy Hageman wrote:
> Hi all,
>
> What is the most efficient way to load a group of postgis polygons into a
> google map api for display? It's possible to just iterate through all of
> the point in the polygon's boundary data to draw the regions, but this
> doesn't seem very efficient. Would it be better to utilize the ST_AsKML or
> ST_AsSVG functions and dynamically stitch together a KML or SVG file to be
> loaded? Or some other method?
>
> -Jeremy H

For Google Maps, the most efficient method I've found is to use encoded 
polygons instead of using ST_AsKML or ST_AsSVG.  The link below provides 
more than enough information about the encoding...

http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/

For polygons with lots of vertices or complexity, I cache the encoding 
polygons as the polygons usually don't change much over time.

-bborie

-- 
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
bkpark at ucdavis.edu



More information about the postgis-users mailing list