Calculating area of a polygon drawn on google map

前端 未结 2 1617
梦毁少年i
梦毁少年i 2020-12-13 07:04

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 Googl

2条回答
  •  -上瘾入骨i
    2020-12-13 07:47

    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

提交回复
热议问题