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?

  • 1
    For this one I would recommend that you investigate ArcGIS Linear Referencing (aka Dynamic Segmnentation, Chainage). – PolyGeo Mar 28 '14 at 21:41
  • @polygeo I will look into that, thanks for your input. – user20408 Mar 31 '14 at 19:19
  • 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. – reima Apr 1 '14 at 7:00
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

  • 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. – user20408 Apr 1 '14 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 – dof1985 May 4 '14 at 5:02
  • Looks like your links have changed; script is now located at http://ianbroad.com/ download/script/ CreatePointsLines.py – Paul Oct 12 '15 at 20:53
  • 1
    This tool is amazing! – traggatmot Nov 11 '15 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.