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
What I would like
Thanks for any suggestions or pointing me to the best practice for this.
Solved! Go to Solution.
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), ", ")
}
}
}
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), ", ")
}
}
}
Thanks again Johannes. Greatly appreciated.
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.
I don't really understand the question here. What values would you expect in this situation?
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!
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
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?
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"."
Sounds good!