Line indicates the road feature layer.The points are the houses feature layer and selected points are the houses that are well connected to the selected road.

Is there any way to determine the left or right side of road using arcpy? I was able to find if road is going from north to south,south to north,east to west or west to east.link that helped:- How to determine right side of the street vs left side?.But still this do not identify the sides on which the point lies.

I am using ArcPy from ArcGIS for Desktop with a Basic level license.


You can use geometry tokens and the queryPointAndDistance function to determine whether a point falls on the right hand-side of a line or not. Right/Left is determined by the digitized direction of the line.

try this:

pnt = [x[0] for x in arcpy.da.SearchCursor("point",["SHAPE@"])][0]
line = [x[0] for x in arcpy.da.SearchCursor("line",["SHAPE@"])][0]

(<PointGeometry object at 0x27b71d30[0x27b71860]>, 178.62560415967232, 19.598416635825153, False)

the tuple above gives you:

  • A PointGeometry that is the nearest point on the polyline to the in_point.
  • The distance between the start point of the line and the returned point on the line.
  • The minimum distance between the line and the in_point.
  • A Boolean that indicates if the in_point is on the right side of the line. The direction of the line determines the right and left sides.


Building on the above, here is an example..

enter image description here

For the points and lines shown above, the code below

import itertools
import arcpy
#create dictionaries for pnts and lines - object id as key and geometry as value
lines = dict([(l[0],l[1]) for l in arcpy.da.SearchCursor("streets",["OBJECTID","SHAPE@"])])
pnts = dict([(p[0],p[1]) for p in arcpy.da.SearchCursor("pnts",["OBJECTID","SHAPE@"])])
#evaluate each point against each line
for pl in itertools.product(pnts,lines):
    pntID = pl[0]
    lineID = pl[1]
    output = lines[lineID].queryPointAndDistance(pnts[pntID])
    print "\nPoint {0} is:\n{2}m from line {1}. \non the right side of line {1}: {3}".format(pntID,lineID,round(output[2],2),output[3])


enter image description here

More info about the itertools module can be found here

  • It seems that the solution you have provided will calculate the left/right side for each single point with respect to each single line? – Mansi Apr 22 '16 at 11:36
  • @Mansi, yes, it will. this was just an example. you can modify it to process points against a single line only. – Nxaunxau Apr 26 '16 at 22:41

One possible (probably not the fastest when the dataset is very large) is to create a buffer with "arcpy.Buffer_analysis" and the "line_side" option. Then you check which points do intersect with the left/right side.

One problem is the dimension of the buffer, that could be set manually or checked from the max distance between points and lines.

The second problem might be the speed of the procedure, especially if you want to loop all your roads, so there might be another more sophiticated answer.

  • Problem is I don't have full license of buffer tool ie. license for buffering lines left and right separately is not available . Second thing is finding distance between points and the line becomes totally a new problem for me. – Mansi Apr 18 '16 at 9:31
  • You are right, haven´t seen the licensing information for the optionals at first. Will leave the answer open as it might be of interest for someone else. – Matte Apr 18 '16 at 12:00

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