# Calculate sequential numbers along line

I am looking for a way to calculate sequential numbers in points feature along line.

I've got polygon 1 feature intersected with other layer of polygons. Then I extract points from the intersection, and get points1 layer. After that I extract the points from the vertices of polygon (1) (points2 layer). Also I create points along line by distance (points3). Then I merege all layers together (points1 + points2 + points3). Then I want to give them a sequential numbers going up along the border of polygon 1 by order.

My goal is to add points along the line that will be in ascending order, in favor of an orientation map for contractors in the field.

Is there a way to calculate it by field calculator?

I am using Arcmap 10.6.

• Welcome to GIS SE. As a new user, please take the Tour, which explains how our Focused question/Best answer model operates. Please remember to always include the exact release of software in use in every question. Frankly, the best time to sequence the polygon points is during conversion from polygon. If the order has been preserved, then Calculate Field can still work, but you really need to provide more details on the data dictionary, sample data, and your input parameters and coding attempt, so we're not completely guessing about your configuration and data. Dec 29, 2019 at 13:08
• Convert your polygon to polyline then use linear reference to measure distance along line, that would give you an order to count along. Dec 29, 2019 at 13:17
• @Hornbydd LR is not working without route calibration, not for me anyway. When I rarely forced to use it, I apply end points for calibration. Won't work for closed line, so one needs to use geometry methods. Dec 31, 2019 at 1:09
• Welcome. I would approach this by creating a feature (either line or point) at the 'proximal' end of your area, then using proximity analysis to create a new field contains the distance between each of your points and the 'origin' layer. Number the point features based on this distance. Dec 31, 2019 at 21:08
• Hornbydd -I tried to work with the linear reference toolbox. I was unable to give the sequence to the points along the polygon/line.I convert the polygon to line, thrn I used the "Create Routes" tool to create a route. I then used the "Locate Features Along Routes" tool to try to give the points sequence number along the line without the success. Jan 1, 2020 at 12:04

If you have polylines stored in shapefile and call them "LINES" in your mxd table of content, below field calculator expression will populate numerical field of your points table by distance from relevant line start:

``````g=arcpy.Geometry()
geomList=arcpy.CopyFeatures_management("LINES",g)
def Chainage(id,shp):
geom=geomList[id]
L=geom.measureOnLine (shp.firstPoint)
return L
#------------
Chainage( !NEAR_FID! , !Shape! )
``````

Thank you, I've been able to use your code snippet, along with another snippet to create a sequence of numbers:

``````counter = 1
rows = arcpy.UpdateCursor("Cities","","","NAME; SortFld", "NAME")
for row in rows:
row.SortFld = counter
counter = counter + 1
rows.updateRow(row)
``````

I found this in another discussion: Sort Column and Sequentially Number Separate Column