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? Also i don't want to be saved in memory but in Hard disc, also i don't have the points i want to create them, with a loop, for several lines (10).
2 Answers
I have a Create Points on Lines toolbox I made that should work for you.
You can download it here:
http://ianbroad.com/arcgis-toolbox-create-points-polylines-arcpy/
Here's the script:
http://ianbroad.com/download/script/CreatePointsLines.py
Here's a screenshot of the parameters:
You'll want to use the Type of INTERVAL. For the interval value, if your coordinate system is in meters, then you just put 10, or 100. But, if it's not in meters you'll need to do the conversion beforehand- depending on what units your coordinate system is based.
-
i have a problem using the tool, it saves the first point at the last column. And i am trying 7 days to change that with python scripts, but still...Is there a way to save the start point at the first row? Commented Mar 31, 2015 at 0:28
-
@kon.pet I'm not sure what you mean. Are you saying the first point created is the last row in the table? What do you mean by column?– ianbroadCommented Mar 31, 2015 at 0:39
-
exactly that. I cannot figure out a way to put the start point at the first row Commented Mar 31, 2015 at 0:43
-
@kon.pet couldn't you just go by the OBJECTID in reverse? Or why do you need them in a certain order?– ianbroadCommented Mar 31, 2015 at 0:48
-
no because when i am going to extraction - sample the results differ a lot for each point. I have tried it a lot the last 7 days with a lot of python but i didn;t achieve it. Isn't there a way to save it at the first row? Commented Mar 31, 2015 at 0:51
The python way of doing it would be to use a a search cursor to get the feature length and the xy position along the line using this method:
!Shape!.positionAlongLine(distanceValue,False).firstPoint.Y
!Shape!.positionAlongLine(distanceValue,False).firstPoint.X
Loop would be defined by feature length and grabs xy pair values per step 10 or 100 (adding distance to the distanceValue variable for each step increase and writing those found xy pair values to the geometry of a new point feature class using a insert cursor.
positionAlongLine
is the key method to know about.