I need to match corner parcel centroids to their corresponding street segment. I want to create an event layer from a near analysis (that matches by street name) to be able to place or create a new point near the street. It would be fantastic if the match could use a like statement to widen the search and lessen front end attribute processing. The standard near analysis is only driven by distance and does not accomplish the matching. Near by Group only offers the distance. I need the location or at least the distance and a bearing.
-
Expression here requires a wee bit modification to complete your task gis.stackexchange.com/questions/185673/arcgis-near-by-group/…– FelixIPCommented Nov 22, 2016 at 5:21
-
Thanks FelixIP, but Is there anything that can give the angle or location as in combination with the matching? Looks like the matching part is doable, but I really need the location of the intersect or some way to calculate its location. Thanks!– ScoobydooCommented Nov 22, 2016 at 17:56
Add a comment
|
1 Answer
INPUT:
Create a copy of your your points layer and run Python field calculator expression on Shape field. This will move points to nearest position on line with matching attribute:
mxd = arcpy.mapping.MapDocument("CURRENT")
lr=arcpy.mapping.ListLayers(mxd)[0]
def movePoint (FID,shp ):
q=r'"LINEID"='+"'"+FID+"'"
with arcpy.da.SearchCursor(lr, 'Shape@',q) as cursor:
for row in cursor: a=row[0];break
aL=a.measureOnLine (shp)
theP=a.positionAlongLine (aL)
return theP
#----------------------
movePoint (!LIDONE!,!Shape!)
NOTE: works on points stored in shapefile.