Select to view content in your preferred language

Summarize Intersecting Line Features with Grid

363
2
10-23-2023 11:51 AM
bbaker_tngeo
New Contributor III

I am trying to create an attribute rule that would automatically update when line features are edited or created. I have gotten half of what I want the rule to accomplish, but am at a loss with the second part. I'm fairly new to Attribute Rules, so the solution may be something I've overlooked or it may not be possible, but any feedback would be greatly appreciated.

Essentially, I have line segments (e.g. Roads) that I want to intersect with a grid (e.g. Map Book Grid). I would like a comma separated list of each road (grouped by Road Name, not for each individual segment) that will update in a separate table (Master Road Names table for those familiar with Address Data Management) that could be exported or added as a Road Index as an appendix to a Map Series. 

I have been able to populate a field within the roads line layer for individual segments but am struggling with how to group by road name and then write all the intersecting grid values to a single field for all of the segments.

bbaker_tngeo_0-1698079533971.png

bbaker_tngeo_1-1698079684253.png

var intersectLayer = OrderBy(Intersects(FeatureSetByName($datastore, "Grid", ["GridNum"], true), $feature), "GridNum asc")
var zones = ""
var i = 0
for (var f in intersectLayer){
    i++
    if (i == 1){
        zones = f.GridNum
    }
    else {
        zones += ", " + f.GridNum
    }
}

return zones

 

0 Kudos
2 Replies
Jake_S
by Esri Contributor
Esri Contributor

Morning,

Try this instead. 

var intersectLayer = OrderBy(Intersects(FeatureSetByName($datastore, "Grid", ["GridNum"], true), $feature), "GridNum asc")

var list = [];
var result
for (var f in intersectLayer) {
    var result = f.GridNum
    Push(list,result)

}
return Concatenate(list, ", ");

 

JS_Esri_0-1698151321994.png

 

Hope this helps.

~Jake

 

0 Kudos
bbaker_tngeo
New Contributor III

Thanks @Jake_S .

That is definitely a cleaner way of summarizing the results. I should have been clearer in my initial post that in my context, each line segment is separate but multiple segments share a common attribute (street name for instance). For a street network, each road (Line 1 for instance) is broken at each intersection, so in my above sample, there are multiple Line 1s, Line 2s, and so forth.

bbaker_tngeo_1-1698329738286.png

 

Would it be possible to group segments by their name (e.g. Line 1) before creating the results, or would those need to be dissolved by name before being able to summarize the intersecting grids?

 

0 Kudos