Hello i have 10 lines and i want to generate points per 10 and 100 meters for each one of them. In ArcGis there is the tool construct points(COGO) but is not scriptable. Is there any suggestion?
Solved! Go to Solution.
positionAlongLine can be used to either densify existing lines or to create new point objects in a new file depending whether you are using an update or insert cursor. Examples abound.
from the help files in the above link
positionAlongLine (value, {use_percentage}) | Returns a point on a line at a specified distance from the beginning of the line. |
where you would want to specify the distance by setting use_percentage=False
I think you asked a similar question which had a similar response recently. If so, it would be useful to indicate where you are along in the process and whether you have an script components written. You should also have a look at the Densify tool and its associated script call in the help files
I don't have a solution right away, but maybe you can find something helpful from this blog post?
Split into equal length features | ArcPy Café
Looks like you need ArcGIS 10.3 for the segmentAlongLine method of a geometry object.
positionAlongLine can be used to either densify existing lines or to create new point objects in a new file depending whether you are using an update or insert cursor. Examples abound.
from the help files in the above link
positionAlongLine (value, {use_percentage}) | Returns a point on a line at a specified distance from the beginning of the line. |
where you would want to specify the distance by setting use_percentage=False
I think you asked a similar question which had a similar response recently. If so, it would be useful to indicate where you are along in the process and whether you have an script components written. You should also have a look at the Densify tool and its associated script call in the help files
I haven't responsed yet because i am trying several things, i ll let you know more about my method and results
<self promotion>Here is an example that comes to mind.</self promotion>
Darren, not sure he is even following this thread anymore, there was post on GIS-SA and someone posted a link to a premade toolset I think the desire to roll it out on his own isn't there.
No Mr Patterson i am still here, and i am still trying all three of the posible ways to see what works best for me. The positionAlongLine you suggested me works very well for my task and Wien's also (for feature classes i created). In addition the premade toolset from Ian is very interesting as a toolbox. I haven't posted my results yet because i am trying to find on my own a solution to the problem i have by using lines that are in memory instead.
here is a simple script i wrote to add points along line at distance that might help you
import arcpy from arcpy import env env.workspace = arcpy.GetParameterAsText(0) polylineFeature = arcpy.GetParameterAsText(1) pointdistance = arcpy.GetParameterAsText(2) pts = [] numPointDistance = repr(pointdistance) with arcpy.da.SearchCursor(polylineFeature,"SHAPE@") as rows: for row in rows: # Skip First Point #pts.append(row[0].positionAlongLine(0)) i = numPointDistance while i < row[0].length: pts.append(row[0].positionAlongLine(i)) i += numPointDistance leng = row[0].length # Skip Last Point #pts.append(row[0].positionAlongLine(leng)) arcpy.CopyFeatures_management(pts, r"StationPoints") del pts
Station Points reminds me a tool from ET Geowizard although you couldn't use that for over a number of points, i ll try that, thanks a lot Mr Sunderman.