0

I have points in a feature class. Each point has its centroid on a unique line feature in a polyline feature class ( 62 points / 62 lines). Furthermore, points and their corresponding lines share unique identifiers in each of their attribute tables. My aim is create a new point feature along each of these lines at a distance (from old point to new point) also determined by a field in the line attributes.

Does this need to be scripted with python or is there a tool I can use?

I'm using ArcMap 10.2.2.

1
  • 1
    Most GIS programs have Linear Referencing tools which will create Events along a route. In ArcGIS, I suggest you have a look at the Linear Referencing toolbox. There are plenty of posts on this site relating to similar tasks.
    – Fezter
    Commented Nov 17, 2015 at 3:28

1 Answer 1

2

100% agree with @Fetzer, this is LR task, can be bulky though. Try this field calculator expression to find X of new point.

def getXY (point, id, d2add):
 mxd = arcpy.mapping.MapDocument("CURRENT")
 lyr=arcpy.mapping.ListLayers(mxd,"LINES")[0]
 q='"ITEMID"=%s%s%s' %(r"'",id,"'")
 with arcpy.da.SearchCursor(lyr,"Shape@",q) as cursor:
  for row in cursor:line=row[0];break
 pointPos=line.measureOnLine((point)+d2add
 pNew=line.positionAlongLine(pointPos).firstPoint
 return pNew.X

To call it use:

getXY ( !Shape!, !ITEMID!, !CHAINAGE!)

where CHAINAGE field name storing distance to add. It requires a bit of adjustment using your field naming. Code assumes that lines layer called LINES in your table of content. Expression to be run on new field, type double. Change last line to get Y.

Tested on shapefile.

11
  • I always like your answers. I had forgotten about the measureOnLine and positionAlongLine methods.
    – Fezter
    Commented Nov 17, 2015 at 5:32
  • Would the "LINES" feature need to a be a route before running this script?
    – Stephen E
    Commented Nov 17, 2015 at 20:32
  • No. Just a layer with source in shapefile with id field type text. The simplest way to implement this is create new fields in point and line layers, call them ITEMID and populate with original IDs, using field calculator. in this case you don't have to modify expression at all
    – FelixIP
    Commented Nov 17, 2015 at 20:35
  • @Fezter thank you. Possibly it's because I have similar characters in my surname:) Well this 2 methods are my favourites, they easily replace LR when dealing with point events. Took ages for ESRI to resurrect them in ArcGIS after ArcView 3
    – FelixIP
    Commented Nov 17, 2015 at 21:18
  • Is there any language in the script that references the point layer name as seen in the table of contents? Also, what is "Shape@" and !Shape! referring to?
    – Stephen E
    Commented Nov 18, 2015 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.