Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Determining if a sequence of GPS coordinates is a straight line

Highlighted
Meteor

How do I know (other than visualizing on a map) if a sequence of lat/long pairs is a straight line or a curve?

 

I'm struggling with differentiating segments of driven routes from each other.

Alteryx Certified Partner

Hi @JakeDeJong ,

 

My suggestion is for you to use the option of a convex hull from a poly build tool and, if the object turns into a line, it is a straight line and if it turns into a polygon, it is a curve.

 

Let me know if that makes sense to your problem.

Best,

Fernando Vizcaino

Highlighted
Alteryx
Alteryx

You can also use a spatial info tool at the end of @fmvizcaino's solution if you need to pull out the word polygon or line for use in your workflow. 

 

spatial.png

Highlighted

Cool question. Just to confirm I understand, how straight is "straight"?

Are you looking for exact straightness (e.g. two points forming a line) or are you OK with the line being a little squiggly, but need to know if the road curves more than a certain amount of degrees?

John

John Hollingsworth
Clear Channel Outdoor
Highlighted
Meteor

@Hollingsworth      I was hoping no one would ask *wink*

 

A small amount of curvature is acceptable.  However, I do not know at what point I draw the line in the sand.

Highlighted
Meteor

Thanks @fmvizcaino - this is a great idea. 

 

Now, all I need to do is find out how to name each sequence.  I have hundreds of 10-15sec GPS traces.  

Highlighted
Meteor

@BrandonB  thanks for the tip!

Highlighted
Alteryx Certified Partner

Glad to help @JakeDeJong .

 

Let me know if you need further assistance building this workflow.

Best,

Fernando Vizcaino

Highlighted
Castor
Castor

Hi @JakeDeJong 

 

How straight is straight. 

 

Since you're only looking a 15 sec of GPS data, you should be able to use the Area (Sq Miles or Sq Kilometers) in the Spatial Info tool, which will give the area of the polygon returned from the Poly-Build tool.  Straight lines will have an area "close" to 0. Curves will have a larger area.  

 

Now you just have to define how "close" to 0 the area of a line has to be to be considered straight

 

Dan

Highlighted
Meteor

Beautiful!  And Brilliant.

This is new territory for me.  Your solution makes so much sense. 

 

Any tips on where I can go for more reading on spatial topics?

 

 

Labels