4

I need to use the editing tool 'Construct Points' on several shapefiles that each have ~1300 polylines. I need to do this to create points every 1km along each of the polylines, which represent the orbits of a satellite. I've tried several other methods such as densify but none of them solve my problem as well as 'Construct Points'. The only problem is that you can only edit one line at a time, which would obviously take too long to do manually.

So I'm wondering, is there a way to implement 'Construct Points' in python so that it loops through all polylines and applies the tool with the same parameters?

I feel like it should be possible, but I've never used editing tools in arcpy so I'm not sure.

The output of 'construct points' is a point shapefile for the points that were constructed along the line used as an input. I'm wondering if I could do it in python such that it constructs the points on the line, then appends the output points to a larger point shapefile.

The following is pseudo code of what I have in mind, although the syntax is of course not correct. If anyone could shed any light, that would be great. I really would like to know if this is even possible with arcpy before I spend time trying to pursue it.

# using just one shapefile as an example (pseudo code, incorrect syntax):
orbitshapefile = (shapefile with ~1300 polylines)
pointshapefile = (empty shapefile to store points)
StartEdit(orbitshapefile) # open editing on the shapefile
for orbitline in orbitshapefile:
 editor.ConstructPoints(orbitline, 1km, ..(other parameters).., outputpoints) # call editing function
 pointshapefile.append(outputpoints) # append output points to 'big' shapefile

I just did construct points manually on just 2 lines in editor and found that using the same point shapefile on the second line that was used with the first adds those points to that shapefile, doesn't overwrite them. However, I need an indication of which line these points came from. There is an 'Id' attribute in the resulting table, but everything is 0. Would there be a way to carry over the line's FID to all the points that came from it (alt. I could do a separate script after that uses intersect b/w line and points to come up with a lineID attribute). An updated version of the above code:

for orbitline in orbitshapefile:
 lineID = orbitline.FID
 editor.ConstructPoints(orbitline, 1km, ..(other parameters).., outputpoints)
 outputpoints[pts that were just created in this iteration].SetAttribute(lineIDField = lineID) 

Some additional thoughts: I'm not sure how to subset the points that were just created-- maybe I could subset by saying something like: points in outputpoints s.t. lineID == 0 (because all points that were created in previous iterations will have their lineID attribute set to something other than 0)

Any thoughts on this rationale?

Can anyone AT LEAST tell me if using an editor tool iteratively in python is even possible?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Mar 28, 2014 at 17:36
2
  • I had similar problem a few months back. Here is a suggestion for a work flow: 1. Merge files 2. Dissolve lines 3. Create empty point file 4. Construct points from dissolved lines 5. Spatial join attributes into points. Commented Apr 1, 2014 at 7:00
  • I downloaded the tool and imported it in arcgis but everytime I attempt to use it, enter file and parameters, after clicking OK it just closes the tool and does nothing else, then my arghis session becomes frozen, forcing me to close arcgis through the task administrator. Any clue what might be going wrong? Commented Apr 23, 2020 at 8:27

2 Answers 2

8

I made a custom Create Points on Lines Toolbox you can download here:

Create Points on Lines Toolbox

View the Source Code

The tool creates points on lines at a specified distance, interval, or percentage value. The value can be fixed or field based. There is also an option to add the starting point, end point, or both to the output Point feature class.

You can also choose a Starting Location. So, if you want a point created 10 feet from the end of the line, change the Starting Location parameter to END.

The output Point feature class contains a field called LineOID, which is the OID of the line the point was created from. This allows data to be joined back to the point. There is also a field called Value, which contains the value that was used to create the point.

Here's a screenshot of the parameters: enter image description here

answered Apr 1, 2014 at 2:37
4
  • 1
    Wow! You are the same Ian that I had been talking to about creating a grid, what a small world. You have saved my life twice now, and I thank you! I'm going to try using this tool right away. Commented Apr 1, 2014 at 14:27
  • 3
    Just had the same problem...Started Python after all tools combinations have failed to provide good results. Great tool @ian... Thanks Commented May 4, 2014 at 5:02
  • Looks like your links have changed; script is now located at http://ianbroad.com/ download/script/ CreatePointsLines.py Commented Oct 12, 2015 at 20:53
  • 1
    This tool is amazing! Commented Nov 11, 2015 at 21:16
1

If I am not totally wrong, a new Tool has been integrated in the Data Management Toolbox which exactly does what you were asking about:

http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/generate-points-along-lines.htm

answered Apr 9, 2018 at 12:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.