polylines and curves counter clockwise

1267
4
03-11-2023 01:45 AM
KanjMadi
New Contributor

Hi everyone, 

This is my first time in this community, I would be so thankful If I could get  support from you guys.

I'm using ArcGIS pro 3.0 and this is the issue: I have a polyline type layer that represent 3000 plot. any solution to make all the lines and curve direction counter clockwise 

regards 

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

no tool specifically but in an edit session

Reverse the direction of a polyline—ArcGIS Pro | Documentation

or this tool

Flip Line (Editing)—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
KimOllivier
Occasional Contributor III

This is even tricky for polygons. Esri enforce a convention of outside clockwise with holes counterclockwise. This is the Right Hand Rule and defines which side of a polygon is UP. But OGC forgot to define this so lots of open tools do not enforce this rule causing spatial analysis errors. To standardise run the Repair Geometry Tool. Note all KML polygons will be corrupt after importing for example.

But what about polylines? There is no convention here but often it matters, such as when labelling text, now more sophisticated thank goodness. But there is no From-To convention for polylines. Even finding the start and end nodes is no longer supported with 'shape files'. It was for coverages with built-in arc node topology.

Someone could write a small python script to find the start and end points and the midpoint (all available functions) and then you need to do some clever vector geometry calculating the vector cross product to see if the polyline curves to the left or right. Then flip all required polylines.

Another approach might be to close the start and end points temporarily to create polygons, then repair geometry, find the ones that have been reversed (repaired) and those are the source polylines that need flipping.

You might be able to use Linear Referencing. When you define routes you nominate the corner of the extent for the start of each route. This makes all the routes run in the same direction. Not quite clockwise but directed.

When calculating a convex hull of a cloud of points the boundary polyline is a clockwise polyline. Maybe you can adapt the very simple algorithm to achieve a similar result. Or make a convex hull and then order your data.

Now I have thought that I don't really understand your question! A picture would help. Do you want all your polylines looking like a stream, or is each one independent?

I am very curious as to why you need them flipped.

0 Kudos
DavidPike
MVP Frequent Contributor

I'd just highlight an error in your post - Esri is clockwise outer rings and anti-clockwise inner rings/holes.

KimOllivier
Occasional Contributor III

Thanks, should have checked that.

0 Kudos