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!
Solved! Go to Solution.
Hi @jt_edin this is what I came up with:
I had to make an iterative macro, so you might want to edit the settings of it to suit your use case
Hope that helps,
Ollie
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.
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.
Just checked my solution on the "toughline" and it works for that too.
@CharlieS your solution is brilliant! Could I trouble you to explain your X and Y calculations?
edit: nvm I think I worked it out 🙂
@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.
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