There doesn't seem to be a length funciton for the Polyline in Google Maps anymore in V3.
Has anyone found a workaround for this functionality gap?
<script type="text/javascript" src="http://maps.google.com/maps/api/js?libraries=geometry&sensor=true"></script> ... var path = poly.getPath(); // or: var path = polygon.getPath(); ... = google.maps.geometry.spherical.computeLength(path.getArray()) ... = google.maps.geometry.spherical.computeArea(path.getArray())
--> distance for polyline, area for polygon
and between two points: computeDistanceBetween()
Don't forget to specify the geometry library (libraries=geometry)
http://code.google.com/apis/maps/documentation/javascript/geometry.html
2.1m questions
2.1m answers
60 comments
57.0k users