3

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.

6

Try this in the python window in ArcMap:

points = []
for row in arcpy.da.SearchCursor('C:/Temp/line.shp', ["SHAPE@"]): # change this to your source line layer
    length = int(row[0].length)
    for i in xrange(0, length + 10, 10): # assuming units are in meters for feature spatial reference
        point = row[0].positionAlongLine(i)
        points.append(point)    
arcpy.CopyFeatures_management(points, 'C:/Temp/points.shp') # change this to wherever you want this layer stored
  • This python script also works perfectly - thank you SO much for your help @artwork21 – user37544 Nov 4 '14 at 20:44
  • I am looking to set up a tool that is similar to this script however I would like to place multiple points on a line at specified distances. I have a code working to place a single point on a line, however my python skills are not good enough to figure out how to do it over multiple iterations with different values. Here is the code I'm currently using to place a single point on a line: – ChrisA Jan 17 '15 at 7:09
  • points =[] with arcpy.da.SearchCursor(Line_Feature, ("SHAPE@")) as cursor: for row in cursor: point.append(row[0].positionAlongLine(float(Distance))) arcpy.CopyFeatures_management(point, Output) – ChrisA Jan 17 '15 at 7:15
4

You can achieve this using the Construct Points tool while in edit mode.

If you need to do this to multiple features, you could use the Densify tool, then use the Feature Vertices to Points. Keep in mind that this assumes you currently have lines, and not polylines, because ALL vertices (even one's not at your specified densify distance) will also become points.

Also, see Creating points in interval 0.125 decimal degree using ArcPy? for a python example to do this process, and Using 'construct points' on all lines in a shapefile (arcpy) for a custom tool.

  • Thank you! Do you know if there is a way to do this to multiple polylines at once? I have almost 300 polylines to do this to. – user37544 Nov 4 '14 at 19:05
  • probably not able to do it at once but you could iterate through a loop fore each line feature construct the points. – landocalrissian Nov 4 '14 at 19:28
  • @Chris R how do you iterate such an operation? – user37544 Nov 4 '14 at 19:41
  • I've not tested this, but does it work if you select all of the features in the feature class? – evv_gis Nov 4 '14 at 19:51
  • 1
    I've edited the answer to include links to the Densify and Feature Vertices to Point geoprocesses. I also added a link to a post that has a decent looking python script. – evv_gis Nov 4 '14 at 20:02

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.