Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Generate evenly spaced points along spatial line / polyline

jt_edin
8 - Asteroid

I've attached a simple spatial line feature which is about 28km long. How can I easily generate evenly spaced point features along this line? For example, create a point at the start point of the line, and then at each 1km until the end of the feature?

 

I know I can explode a polyline into its point nodes using poly-split, and I suppose I could do some trigonometry to further subdivide these straight line node-to-node edges to position a point exactly 1km apart. However that sounds like a lot of work.

 

Is there an easier way to create points along a line? I think in ArcGIS this is trivial, but I appreciate comparing Alteryx with ArcGIS is like comparing apples and pears. 

 

Thanks!pointsalongline.JPG

10 REPLIES 10
jrgo
14 - Magnetar

@jt_edin 

 

May not be exact, but here's the closest I was able to come... workflow attached.

image.png

OllieClarke
15 - Aurora
15 - Aurora

Hi @jt_edin this is what I came up with:

OutputOutput

 

I had to make an iterative macro, so you might want to edit the settings of it to suit your use case 

The workflowThe workflow

The macroThe macro

 

Hope that helps,

 

Ollie

jt_edin
8 - Asteroid

Thank you to @OllieClarke and @jrgo for your speedy and ingenious solutions. I hate to be ungrateful, but what if my line isn't so simple, see attached? I had considered the buffer / radius approach, but realised it would only work for relatively 'unbendy' lines. What about the example below?

 

Thank you again for your superb contributions.

 

toughline.JPG 

jrgo
14 - Magnetar

@jt_edin 

 

yeah, that would definitely through a wrench in my solution. May have to go the macro/iterative route as @OllieClarke had done. Not something I can explore at the moment, but I'll try when i have a chance to if no solution has been marked yet.

CharlieS
17 - Castor
17 - Castor

I generated a lot of points (0.001 Km intervals) along the original polyline line segments. This retained the accuracy of the original polyline points and gave me very granular distances to group into 1 Km sequences. 

 

20191028-1KmLineSegments.png

CharlieS
17 - Castor
17 - Castor

Just checked my solution on the "toughline" and it works for that too.

 

20191028-toughline.png

 

OllieClarke
15 - Aurora
15 - Aurora

@CharlieS your solution is brilliant! Could I trouble you to explain your X and Y calculations?

 

edit: nvm I think I worked it out 🙂

CharlieS
17 - Castor
17 - Castor

@OllieClarke wrote:

Could I trouble you to explain your X and Y calculations?


Sure thing.

 

I have the original polyline input into this section as linear line segments and I've already assigned a number of how many segments I want to break it into (based on the accuracy intervals per length of that linear segment).

 

- Spatial Info generates start and end points as SpatialObjs. In hindsight, I could make the workflow a little more efficient by generating the Lat/Lon values of the points since that's what I actually use. 

- Generate Rows creates a record for each of the accuracy intervals.

- While reviewing this, I realized the Tile tool is redundant since I already have RowCount. I removed it and updated the formulas to reflect this. Sorry for this oversight. 

- Now that I know I know the start and end X/Y values and the portion of that distance each accuracy interval needs to travel, I calculate new X and Y values as moving from the start to the end by the X/Y portion that each record represents of that segment. In other words, if I start at 3 and have 4 parts that end at 4, each part is 0.25 closer since everything is linear at this point. 

- These new X/Y values create spatial objects with the Create Points tool. 

- Select removes unnecessary fields. 

 

I made the version 2 attached that simplifies this section in the ways I mention above. 

 

20191028-1KmLineSegments-AddPoints.png

jt_edin
8 - Asteroid

Just to follow up, this is how I used @CharlieS brilliant solution: https://www.youtube.com/watch?v=3Cny9yl-GaQ&feature=youtu.be

 

I downloaded some bike hire data and infilled probable routes between the origin and destination points. I then used the ride duration to subdivide the route into chunks where each output frame = 1 minute of time. I adapted @CharlieS code and changed an integer to a double to split each line differently depending on the ride duration.

 

Thanks again for your help, I will be presenting on this tomorrow and will flag up how amazing this community is!

 

https://www.eventbrite.com/e/edinburgh-alteryx-user-group-mtg-inaugural-registration-73880824535

Labels