Calculating area of a polygon drawn on google map

Kunal picture Kunal · Jan 27, 2012 · Viewed 51.7k times · Source

I am looking for an accurate algorithm or a service to calculate surface area on earth where points are calculated on the basis of GPS Coordinates.

I am using Google Map Api version 3 and are drawing polygons based on recorded coordinates but I don't think the standard ways of calculating area of the polygon will take into account of slopes(hills). Do I need to work on contours for such thing?

Are there any third party services may be ArcGis or some other that takes into account of slopes as well.

Answer

Brad picture Brad · Jan 28, 2012

Yes, this is definitely possible. There is a quick tutorial with example code here:

https://web.archive.org/web/20130301120148/http://geojason.info/demos/line-length-polygon-area-google-maps-v3

The relevant part is this:

google.maps.geometry.spherical.computeArea(yourPolygon.getPath());

Official documentation:

http://code.google.com/apis/maps/documentation/javascript/reference.html#spherical