Search code examples
google-mapsgoogle-maps-api-3gpsgoogle-maps-api-2

Download GPS Coordinates from Google Map Polygon


I'm building an interactive map of US states and Canadian provinces. I have a working copy here: http://www.willoughby-ind.com/FINDAREP.aspx. It's fully functional and does all I want it to. You can tell I got the US from one source and CA from another. The US data source was hand drawn and is good enough for my needs. The Canadian data source is very accurate as it came from an official source, but it's so accurate it's also slow to load. I'd like to hand draw my own GPS coordinates and download the coordinate data so that I can put it into the format Google Maps can import.

Google has this demo of how to create your own polygons: http://googlemapsapi.blogspot.com/2008/05/love-my-maps-use-its-line-and-shape.html. I'd like to see if I can easily extend that to download the list of coordinates in the selected polygon. Has anyone seen this already in existence, or do I need to interact with the API myself?


Solution

    1. You are using the Google Maps API v2, that is deprecated and may stop working as early as May 2013.
    2. You are parsing the polygons in the client. You may get better performance by converting the polygons to KML and loading them using KmlLayer or importing the KML into FusionTables and loading them using FusionTablesLayer. Both KmlLayer and FusionTablesLayer are rendered as tiles served from Google's servers. FusionTables contains the Natural Earth data set in a public table, that data set contains both US and Canadian state/province polygons:

    USA

    Canada