Alteryx Designer Desktop Discussions

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

Determining if a sequence of GPS coordinates is a straight line

JDeJong
8 - Asteroid

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.

10 REPLIES 10
fmvizcaino
17 - Castor
17 - Castor

Hi @JDeJong ,

 

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

BrandonB
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

Hollingsworth
12 - Quasar
12 - Quasar

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
JDeJong
8 - Asteroid

@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.

JDeJong
8 - Asteroid

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.  

JDeJong
8 - Asteroid

@BrandonB  thanks for the tip!

fmvizcaino
17 - Castor
17 - Castor

Glad to help @JDeJong .

 

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

Best,

Fernando Vizcaino

danilang
19 - Altair
19 - Altair

Hi @JDeJong 

 

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

JDeJong
8 - Asteroid

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