Adding Intersecting (Start and End) Road Names to Road Segments within Road Feature Class

975
9
Jump to solution
08-31-2022 02:07 PM
Labels (2)
ChrisSpadi
New Contributor III

Greetings, 

I am going to start fresh. I had chased down a few old posts relating to this topic but they all didn't produce the desire result.

Starting Data

  • Feature Class (Road network of street segments with the following fields: NAME_ALF (Street segment name), BegLocation (Segment Start, intersecting road), EndLocation (Segment End, intersecting Road)

Work 2.png

What I would like

work 3.png

 Thanks for any suggestions or pointing me to the best practice for this.

 

0 Kudos
1 Solution

Accepted Solutions
JohannesLindner
MVP Frequent Contributor

For Field Calculation:

// change the first line depending on field
var p = Geometry($feature).paths[0][0]  // BegLocation
var p = Geometry($feature).paths[-1][-1]  // EndLocation

var streets_at_point = Intersects($featureset, p)
var this_street = $feature.NAME_ALF
var other_streets = Filter(streets_at_point, "NAME_ALF<> @this_street")
var street_names = []
for(var os in other_streets) {
    Push(street_names, os.NAME_ALF)
}
return Concatenate(Distinct(street_names), ", ")

 

 

For Attribute Rule:

// Calculation Attribute Rule
// triggers: Insert, Update,
// field: empty

var p_start = Geometry($feature).paths[0][0]
var p_end = Geometry($feature).paths[-1][-1]
var this_street = $feature.NAME_ALF

var streets_start = Intersects($featureset, p_start)
var other_streets = Filter(streets_start, "NAME_ALF<> @this_street")
var start_names = []
for(var os in other_streets) {
    Push(start_names, os.NAME_ALF)
}

var streets_end = Intersects($featureset, p_end)
var other_streets = Filter(streets_end, "NAME_ALF<> @this_street")
var end_names = []
for(var os in other_streets) {
    Push(end_names, os.NAME_ALF)
}

return {
    result: {
        attributes: {
            BegLocation: Concatenate(Distinct(start_names), ", "),
            EndLocation: Concatenate(Distinct(end_names), ", ")
        }
    }
}

Have a great day!
Johannes

View solution in original post

9 Replies
JohannesLindner
MVP Frequent Contributor

For Field Calculation:

// change the first line depending on field
var p = Geometry($feature).paths[0][0]  // BegLocation
var p = Geometry($feature).paths[-1][-1]  // EndLocation

var streets_at_point = Intersects($featureset, p)
var this_street = $feature.NAME_ALF
var other_streets = Filter(streets_at_point, "NAME_ALF<> @this_street")
var street_names = []
for(var os in other_streets) {
    Push(street_names, os.NAME_ALF)
}
return Concatenate(Distinct(street_names), ", ")

 

 

For Attribute Rule:

// Calculation Attribute Rule
// triggers: Insert, Update,
// field: empty

var p_start = Geometry($feature).paths[0][0]
var p_end = Geometry($feature).paths[-1][-1]
var this_street = $feature.NAME_ALF

var streets_start = Intersects($featureset, p_start)
var other_streets = Filter(streets_start, "NAME_ALF<> @this_street")
var start_names = []
for(var os in other_streets) {
    Push(start_names, os.NAME_ALF)
}

var streets_end = Intersects($featureset, p_end)
var other_streets = Filter(streets_end, "NAME_ALF<> @this_street")
var end_names = []
for(var os in other_streets) {
    Push(end_names, os.NAME_ALF)
}

return {
    result: {
        attributes: {
            BegLocation: Concatenate(Distinct(start_names), ", "),
            EndLocation: Concatenate(Distinct(end_names), ", ")
        }
    }
}

Have a great day!
Johannes
ChrisSpadi
New Contributor III

Thanks again Johannes. Greatly appreciated.

0 Kudos
Elizabeth_Burniston
New Contributor III

This solution worked perfectly for street segments, but is there a way to do the same thing for street segments that are connected? A shown on the map, some streets with the same name are separated.

BurnistonElizabeth_0-1664310409296.png

 

 

 

0 Kudos
JohannesLindner
MVP Frequent Contributor

I don't really understand the question here. What values would you expect in this situation?


Have a great day!
Johannes
0 Kudos
Elizabeth_Burniston
New Contributor III

Actually, and I should have thought of this earlier, I think my first step is to dissolve the street segments of a continuous street. Then the field calc would give me the results I need. I got it! Thanks for the initial solution!

0 Kudos
ChrisSpadi
New Contributor III

Hi Elizabeth,

That's what I thought you were probably asking, that's what I would have done is dissolve by street name. I kept the segmented sections for asset management purposes incase only part of pavement is treated. Glad it worked out for you.

Chris

0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor

Hi ChrisSpadi,

I am just wondering if you have a situation where more than one roads are joining at the begin/end of a road. If you do, what would the output fields be?

0 Kudos
ChrisSpadi
New Contributor III

From JohannesLindner: 

"It returns a string of all intersecting streets. If a street intersects "Street A" and "Street B", the returned value will be "Street A, Street B"."

0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor

Sounds good! 

0 Kudos