# Selecting nearest polygons on both sides of polyline in ArcMap?

I have a polyline (in red), and several lots on each side of the polyline (in yellow). I would like to select the lots which are closest on each side of the polyline (selected in blue). I have tried to use a buffer around the polyline, but the distance between the lots and the polyline varies. So, a buffer with a large distance would capture too many lots and a buffer with too small of a distance would capture too few.

My question is similar in nature to Get nearest polygons in both sides of a polyline with arcpy, but my problem is that there are several lots "behind" a lot, and I need to select only the closest lot.

• This is a complex problem that can only be solved in multiple steps that test both lots that meet your criteria and lots that don't meet your criteria that fall within a buffer that is at least large enough to touch all candidate lots you want to consider. The other steps depend on the rules you define. The easiest rule would be unblocked lines of sight along tangents from the line, but your example violates that rule in several places. Your example is missing lots that can be seen from all angles. Your line of sight rules need to be defined precisely before a solution can be proposed. Commented Jan 9, 2019 at 20:32
• Very interesting GIS problem but I totally agree with @RichardFairhurst, looking at your selections I can see several examples of selected polygons violating a nearest straight line distance which are not the nearest, why would they be selected? You need to tighten up your criteria on selecting polygons nearest to red line. Commented Jan 9, 2019 at 22:56
• Hi - apologies for the confusing question, as I am new to ArcGIS and to the GIS stack exchange. From the answers, it looks like I was asking about lines of sight, as Felix's answer below illustrates what I was trying to do. My picture was a rough approximation of what I was trying to achieve. Should I take the photo down to avoid confusion? Commented Jan 10, 2019 at 1:47
• I would leave the image up, helps people understand our comments and your question. I personally think questions with images are much more informative as GIS is a visual thing... Commented Jan 11, 2019 at 12:37

Results shown below based on assumption that parcel is near the road if:

• it is within 100 m distance and

This can be achieved by creating lines of sight from multiple points on the road. Note these lines are shown for only one point on the road:

WORKFLOW:

• densify your road and convert feature vertices to points. This will create points shown in red.
• Add geometry attributes to points and buffer points by 100 m. Convert feature vertices to points (they are going to be end points for the rays coming out of red points). Populate any field, but XY ones, by unique name using field calculator.
• To create start points for each ray use X and Y fields in buffer points (make XY event layer). Convert event layer to points, called CLONES.
• Merge CLONES and points on the buffer and use points to line and unique ID to create web of 72 rays going out from each red point. (To improve results consider densify on buffers before extracting their vertices otherwise rays at 5 degrees might miss narrow parcel connected to road)
• What is left now is erasing rays by parcels. However erase is very slow and nor reliable tool, this is why I created shape (pink) outside parcels and use it to clip rays. (Use union of parcels with envelope of parcels to derive such polygon).
• Convert erased rays to single part features from potentially multipart. Delete ones that do not intersect roads. Use remaining bits of rays to select parcels by location.
• Felix - yes, this is exactly what I was looking for! Could you please share the workflow with me? Commented Jan 10, 2019 at 1:46
• Perhaps cyan, not pink. Ha-ha Commented Jan 10, 2019 at 3:05
• Thank you so much Felix! I have some clarifying questions: in step 2, what feature vertices do we convert to points? Is it the buffers? In step 4, how do you ensure the rays go from red point to buffer points when using Points to Line? Finally, is it possible to only have rays which are perpendicular to the red line? For example, say I wanted to exclude parcels which are not "adjacent" to the road with the red line, such as some of the green parcels on the bottom right of the picture. Is that possible? Commented Jan 10, 2019 at 3:36
• Step 2 - buffer points. Step 4 - direction doesn't matter. It will be defined by order of layers in merge tool. See my next comment re perpendicular search. Commented Jan 10, 2019 at 4:17
• gis.stackexchange.com/questions/201867/… apply it to red points. Commented Jan 10, 2019 at 4:18

These Steps perform a type of Line of Sight operation as @Richard suggested.

----Or use Calculate Geometry to populate Point_X,Point_Y centroid values.
Near, Lot Polygons to Red Line, include LOCATION.
----Adds Near_X, Near_Y to Lots FC
XYToLine_management, Point_X,Point_Y,Near_X, Near_Y, output as XYLine_fc.
----created Lines from Lot centroids to closest pt on the Red Line
SpatialJoin, Input XYLine_fc, Lots. Output as SPjoin_fc.
----Join_One_to_One
----match_option = Intersect
----In the Field Map window, add a new field called IDS
----add Lot.objectid or Lot.fid to IDS
----set Merge rule to Join, comma as the delimiter
----(Lines that Intersect Multiple Lots will have multiple IDs 2,3,4 in IDS)

Select_by_Attribute, Select SPjoin_fc records where IDS not Like '%,%'.
Select_by_Location, Lots that Intersect selected SPjoin_fc lines.