Select to view content in your preferred language

Identify a polygon to the right or left of a line

2167
4
Jump to solution
08-20-2020 06:04 AM
MarkVolz
Frequent Contributor

Hello,

I have a road line feature class and a city township unit polygon feature class.  One of the requirements of the line feature class is that I need to correctly identify which polygon is on either side of the line.  The closest solution I found thus far makes the assumption that the line is strait.  However, it is very possible that the line could be curved as well.

There are a couple ways that I could perform this, but I don't know how to implement these solutions.

  1. Perhaps there is already a geoprocessing tool, python script, or Aracade script that can already do this.  This would be preferred.
  2. If I could create a point halfway down the line that is offset to the right or left by several feet then I could use that point to identify the line and rejoin the needed point value back into the correct field in the line feature.

This should be very similar to the calculate adjacent fields, except it should identify values to the right or left of a line.

Thanks for any help!

1 Solution

Accepted Solutions
JoshSaad1
Frequent Contributor

I just figured this out the other day.  You can use the Offset function in Arcade.  Here's the code that I use to calculate the neighborhood on the left-side of a road segment.

//Set the neighborhood dataset, selecting only the neighborhood name field.
var fsNbrhd = FeatureSetByName($datastore, "GIS.DBO.Neighborhood", ["nbrhdname"])

//Specifies the left-side of the road. If the offset is greater than 0, it will be the right-side.
var RoadLeft = offset($feature, -1, 'feet', 'square')

//Selects the neighborhood polygon on the left-side of the road.
var fsNbrhdLeft = Intersects(fsNbrhd, RoadLeft)

//Returns only the first intersecting polygon, in case there are overlaps.
var NbrhdLeft = First(fsNbrhdLeft)

if(NbrhdLeft == null) return null

//Returns the name of the first intersecting neighborhood polygon on the left-side of the road segment.
return NbrhdLeft.nbrhdname

  

View solution in original post

4 Replies
DuncanHornby
MVP Notable Contributor

Suggest you look at this thread.

0 Kudos
datasolutions
New Contributor

Anyone find a solution/calculation for this? I located a rule attribute in the Address Data Management Solution, but it is not working. 

0 Kudos
JoshSaad1
Frequent Contributor

I just figured this out the other day.  You can use the Offset function in Arcade.  Here's the code that I use to calculate the neighborhood on the left-side of a road segment.

//Set the neighborhood dataset, selecting only the neighborhood name field.
var fsNbrhd = FeatureSetByName($datastore, "GIS.DBO.Neighborhood", ["nbrhdname"])

//Specifies the left-side of the road. If the offset is greater than 0, it will be the right-side.
var RoadLeft = offset($feature, -1, 'feet', 'square')

//Selects the neighborhood polygon on the left-side of the road.
var fsNbrhdLeft = Intersects(fsNbrhd, RoadLeft)

//Returns only the first intersecting polygon, in case there are overlaps.
var NbrhdLeft = First(fsNbrhdLeft)

if(NbrhdLeft == null) return null

//Returns the name of the first intersecting neighborhood polygon on the left-side of the road segment.
return NbrhdLeft.nbrhdname

  

ChelseaRozek
MVP Regular Contributor

Thanks for posting that! That's a clever way of doing it. This is going to be so helpful.

0 Kudos