Select to view content in your preferred language

Create a polygon or polyline from points that are not ordered sequentially

1291
2
Jump to solution
05-07-2023 01:32 PM
MattHowe
Frequent Contributor

I have a number of points that are positioned representing a polygon. I need to convert the points to a polygon or line but the features are not sequential and the OIDs are mixed up. Using Python, how can I create a polygon or line from these points, essentially reordering them so they are sequential in a e.g. clockwise direction? Sort doesn't do the job and calculating the bearing to a mean position of all points won't work for concave or complex polygons.

points2.PNGpoints1.PNG

Tags (3)
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

is the lower portion of the image supposed to be what the upper part represents?  The extents don't match so you might want to share a sample of your data and a bit of an explanation of it.

Concave Hulls, of which there are several code examples, can be used to generate poly* bounds from point coordinates, regardless of id values

Concave Hulls ... the elusive container - Esri Community

Point Tools .... - Esri Community


... sort of retired...

View solution in original post

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

is the lower portion of the image supposed to be what the upper part represents?  The extents don't match so you might want to share a sample of your data and a bit of an explanation of it.

Concave Hulls, of which there are several code examples, can be used to generate poly* bounds from point coordinates, regardless of id values

Concave Hulls ... the elusive container - Esri Community

Point Tools .... - Esri Community


... sort of retired...
0 Kudos
MattHowe
Frequent Contributor

Thanks Dan. The lower image is the full extent, then upper image is a zoomed portion showing the aligned points I need to make a polygon from. All of which have mixed up objectids. Do you have new links to the Points toolbox? They don't seem to be working.

Links.PNG

p.s. Found it! Thanks. GitHub - Dan-Patterson/Tools_for_ArcGIS_Pro: Python Code Samples and toolboxes for use in ArcGIS Pro...

Point Tools for Pro - Esri Community

Update:

MST is nearly there but with a couple of imperfections.
mst2.PNG      mst.PNG

Concave hull works in one place where MST doesn't but overall MST is better. Getting there...

ch.PNG

0 Kudos