最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to findcreate Convex hull of GPS points in Javascript - Stack Overflow

programmeradmin2浏览0评论

I have a GPS cluster (contains many GPS points which are close to each other) and I want to identify it as a place by creating a polygon around its outer points. One way is Convex Hull and I am looking for its implementation in Javascript.

Any idea?

I have a GPS cluster (contains many GPS points which are close to each other) and I want to identify it as a place by creating a polygon around its outer points. One way is Convex Hull and I am looking for its implementation in Javascript.

Any idea?

Share Improve this question asked Jan 4, 2011 at 1:23 ZaheerZaheer 3755 silver badges20 bronze badges 1
  • 2 it looks relevant: geocodezip./map-markers_ConvexHull_Polygon.asp – Zaheer Commented Jan 4, 2011 at 1:28
Add a ment  | 

2 Answers 2

Reset to default 3

The following demo displays how to calculate a convex hull that will plot an outer boundary or the area for the given coordinates. This demo is implemented in javascript

http://www.geocodezip./v3_map-markers_convexhull.asp

The code for the demo is located at https://github./mgomes/ConvexHull

The convex hull is a concept that has not been provided in google maps API yet.

Yep. Check out the source in the tag. there's two separate scripts: one that executes the hull algorithm, and the other has the google maps API stuff in it.

In the example, the Initiation() function is called by the body's onload event, which sets up all of the listeners for click events, creates the random points and such.

Check out the algorithm for the hull, the chainHull_2D(P,n,H) function. It took me a bit to follow it but once I got a grasp it makes a lot of sense. The function spits H back out with the array of GLatLng of the hull. A GPolygon is then created using the array of GLatLng.

GPolygon implements googles maps overlay interface so you use the Map.addOverlay function to display the polygon.

Check this tutorial out too to better understand the maps API.

发布评论

评论列表(0)

  1. 暂无评论