Convex Hull / Minimum Bounding / Envelope, etc...

368
2
Jump to solution
07-08-2023 11:36 AM
MarkLittell
New Contributor III

I read in a JSON with multiple points. I want to create a polygon that contains all the points.

Seems there was a way to do this JS 3.X, https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=util_convexhull

I cannot find out how to do it 4.x

I don't want the map extent; the area is too large.

I've tried to do the extent of a Graphics Layer after adding the points, it defaults to +-180 / +-90.

 I was trying to do the geometryService.ConvexHull and could not figure out how to properly insert the point geometries.

Any help is appreciated.

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

You can do it several different ways.

You can do it using geometryService.convexHull as mentioned above but it is requires a trip to a server.

You can use geometryEngineAsync.convexHull() method and the calculation will run on the client-side without having to go back to the server.  I created a simple codepen to showcase how to use geometryEngineAsync's convexHull method. 

If you are working with ArcGIS Online hosted feature service then you can take advantage of convex-hull-aggregrate statistics with query.

 

 

View solution in original post

2 Replies
mleahy_cl
New Contributor III

Try creating a single mutipoint geometry from your points, then use the geometryService.ConvexHull method.  Maybe that will work.

UndralBatsukh
Esri Regular Contributor

Hi there, 

You can do it several different ways.

You can do it using geometryService.convexHull as mentioned above but it is requires a trip to a server.

You can use geometryEngineAsync.convexHull() method and the calculation will run on the client-side without having to go back to the server.  I created a simple codepen to showcase how to use geometryEngineAsync's convexHull method. 

If you are working with ArcGIS Online hosted feature service then you can take advantage of convex-hull-aggregrate statistics with query.