How do I to draw a polygon which defines a boundary to contain all points

110 views
Skip to first unread message

Big G

unread,
Jan 8, 2012, 8:12:17 PM1/8/12
to google-map...@googlegroups.com
I have a problem where I have many data points which define sales on a map for a specific individual and I want to generate a polygon which defines the boundary which contains all these sale points to define the sales area for that individual.  i.e. some points will make up the polygon but others will not as they will be inside the polygon.  Hope this makes sense?!  Does anyone know of any code available to do this?  or how I might go about writing the code to do this?

Thanks in advance for any help given

Marcelo

unread,
Jan 8, 2012, 9:25:27 PM1/8/12
to Google Maps JavaScript API v3
Search for a "convex hull" algorithm.

--
Marcelo - http://maps.forum.nu
--

Artur O

unread,
Jan 9, 2012, 3:14:23 AM1/9/12
to Google Maps JavaScript API v3
Hi Big G,

can the boundary be LatLngBounds object ? if so, just use
bounds.extend(next point) over the all points array .

Big G

unread,
Jan 9, 2012, 8:39:59 AM1/9/12
to google-map...@googlegroups.com
I've found a convex hull example in api v2 but think a concave hull algorithm would be better but struggling to find a code example.  Do you know of any?

Marcelo

unread,
Jan 9, 2012, 12:48:46 PM1/9/12
to Google Maps JavaScript API v3
Reply all
Reply to author
Forward
0 new messages