I am a newby in python scripting in GIS. I have 2 shapefile: first one with roads and second one with points that contains address number and street name.

enter image description here

I want to select these points from right or left side of the street but in the correct order according to the street start and end.

enter image description here

Firstly, I want to select the points from the red polygon and check them (checking is another task and I know how to do it but selecting this points in the right order..)

Secondly, the same. I want to select the points from the blue polygon an check them too.

NB: Points is a layer, roads is another layer. also buffer of the roads is another layer.

I think that would be a good idea to parse the buffer and select by location the points that is in the buffer, but i don't know how.

  • possible duplicate of How to Plot Every Other Address on Street? – radouxju Nov 3 '14 at 19:34
  • 2
    Would you be able to edit your question to include a picture of what you are trying to describe in words, please? To me it does not sound like the suggested duplicate but I am not certain so perhaps it is. – PolyGeo Nov 3 '14 at 21:40
  • I have edited the post. It should be more clear. Thanks for your help ! – Daniel Păun Nov 4 '14 at 9:10
  • 2
    I do not think that this is a duplicate of the other question, since this is about selecting points on one side of the road, and not every other point. – Devdatta Tengshe Nov 4 '14 at 12:40
  • And how about my question? I need a hint, a help, please! – Daniel Păun Nov 4 '14 at 14:45

EDIT: I've revamped this answer after realizing that Linear Referencing supports determining the side along a line.

The best approach to this problem is to use the Linear Referencing toolbox in ArcGIS:

A linear reference system stores data using a relative position along existing line features. That is, location is given in terms of a known linear feature and a position, or measure, along it. For example, route I-10, mile 23.2, uniquely identifies a position in geographic space, and can be used instead of an x,y coordinate.

Linear referencing point to line

Here's how you would do it, assuming we're using the streets and lines below:

Example points and lines

  • Run the Create Routes (Linear Referencing) tool with your streets as your in_line_features. Pick a unique ID field for the route_id_field parameter. You can leave all other parameters as their defaults.

  • Run the Locate Features Along Routes (Linear Referencing) tool with your points as the in_features, the routes we created above as the in_routes, and the street ID field as your route_id_field. You should change your radius_or_tolerance such that there's enough distance from your streets to capture all of your points. Lastly, uncheck the m_direction_offsetting parameter; this will make it such that the left/right designation is based on the digitization direction of your streets rather than the more arbitrary direction of your routes.

  • In your output table (shown below), you will have one row for each point. The value in the MEAS field represents the distance along the street that the point is located. The value in the Distance field represents the distance from the point to the snapped nearest location in your street, where the sign of the distance indicate the side of the street. So negative values indicate points to the left of the street and positive values indicate points to the right of the street.

Attribute table

To iterate through your left-side points, sort the table by RID and MEAS and skip positive values; do the same but reverse the sorting of MEAS and skip negative values to iterate through your ride-side points in reverse order. It's probably easiest to sort in Python:

points = []
cursor = arcpy.da.SearchCursor(eventTable, ["RID","MEAS","Distance","OBJECTID"])
for row in cursor:
    if row[2] < 0: #negative value = digitized left
    else: #positive value = digitized right
        points.append((row[0],"R",row[1]*-1.0)) #negate MEAS to reverse direction
points.sort() #will break ties when sorting using 2nd or 3rd element in tuple
print [point[3] for point in points]

This results in our points sorted by street ID, then left side from start to end, then right side from end to start:

[9, 11, 12, 10, 8, 1, 4, 6, 5, 3, 2, 7]

If you have an advanced license, you can use Buffer (Analysis) and make Left and Right buffers. Then you can "Select by Location" points within either the Left or the Right buffers.

  • But this is what I have done. If you see, both pictures depicts that I've used buffer analysis but select by location not.. and I don't know how to do that. Can you give me, "where clause" from select by location? – Daniel Păun Nov 4 '14 at 15:09
  • 1
    Do you have advanced license level? There is a 'line_side' option, make a Left buffer, and then make a Right buffer. At the top of your ArcMAP toolbar there is 'Selection', click that, then 'Select by Location'. From that, choose your points as target layers, and then your buffer (L or R) as source layer. Then for selection method you can specify 'within' or 'intersect' by some sort of tolerance – Maksim Nov 4 '14 at 15:15
  • And It is another problem with this buffer. I applied this tool with 25 meters but for the other street, this points may be situated at more than 25 meters from the road.. and I'll need a big buffer.. – Daniel Păun Nov 4 '14 at 15:17
  • You can use Generate Near Table, this will give you distances from all points to your line features. Determine your tolerance from that – Maksim Nov 4 '14 at 15:23
  • How can I use intersect tool to generate points at the streets intersection and these points to contain both streets name? – Daniel Păun Nov 4 '14 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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