Saturday 19 September 2015

arcpy - Creating series of points along multiple polylines at once in ArcMap?


I have a series of polylines that represent linear vegetation (shelterbelts, etc). I need to convert these to a series of points equally spaced in order to add them to a different shapefile that represents point vegetation (individual trees). I should also mention that I have about 300 polylines to do this to, so would like to be able to do them all at once. The polylines vary in length, but regardless of length, I want to place points at the start at end of each line, and then every 10 m.


I would imagine that this will require python script. Of which I am not familiar with how to write.


Does anyone know how I can do this in ArcMap 10?


I looked at a similar question previously posted for someone who wanted to create 6 points on 70,000 lines of various length and found this python script:


import arcpy
points = []
for row in arcpy.da.SearchCursor("YourInputLinesFileHere", ["SHAPE@"]):
length = row[0].length

for i in range(0,6):
point = row[0].positionAlongLine(length/5*i)
points.append(point)
arcpy.CopyFeatures_management(points, 'YourOutputPointsFileHere')

So I know it must be possible with python but am not familiar with it enough to manipulate this.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...