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?