everyone. Recently, we have encountered a problem about the boundary on Google Map.
We have received lots of points which are the objects as ‘new google.maps.LatLng(lat,lng)’. Then, how to draw or make the boundary of this chunk. Or how to find the points (LatLng, used to draw the polygon) on the boundary, is there any JS arithmetic ?
Just like one story: we receive many sheep(points) as presents, so how to build the sheepfold with clear boundary for them ?
Thank you very much for any reply !!!
What you’re looking for is a “convex hull” algorithm. Here’s an example of one (you’ll need to view source):
http://www.geocodezip.com/v3_map-markers_ConvexHull.asp
Here’s a previous question about this as well:
How to find/create Convex hull of GPS points in Javascript