# How can i create points per 10 and 100 meters for several lines with ArcPy?

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).

• This code is saved in memory instead of Hard disc i want, also i want to create a loop for creating pnts per specific dinstance (which i don't have) and also to do that for several lines inside the same loop Commented Mar 18, 2015 at 23:41
• To revise your question with more details like this please use the edit button beneath it. Doing so should improve its chances of being re-opened. I just realized that I linked to the wrong answer - it should be gis.stackexchange.com/a/84074. `positionAlongLine` is the key method to know about.
– PolyGeo
Commented Mar 18, 2015 at 23:50

I have a Create Points on Lines toolbox I made that should work for you.

Here's the script:

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? Commented 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? Commented 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.