I have an arcade expression for a popup that returns a text string comprised of a land use description and a length. How would I go about summarizing the total length by the land use description?
var buffer = BufferGeodetic($feature, 50, "feet")
var int_ma = Intersects(FeatureSetByName($map, "AllParcels"), BufferGeodetic($feature, 50, "feet"))
var leng = LengthGeodetic($feature, 'feet')
var int_dict = {}
var xs = ""
for (var i in int_ma){
var xs = AreaGeodetic(Intersection(buffer, i), 'square-feet')
if(HasKey(int_dict,i.USE_CODE)){
int_dict[i.USE_CODE] += xs
} else {
int_dict[i.USE_CODE] = xs
}
var total = 0
var out_str = 0
for (var t in int_dict){
total += sum(number(int_dict[t]))
}
for (var d in int_dict){
var Ucode = decode(d,
"0101", "Multiple-Use, Primarily Residential",
"031", "Multiple-Use, Primarily Commercial",
"101", "Residential, Single Family",
"102", "Residential, Multi-family",
"1320", "Residential, Vacant Land",
"140", "Residential, Other",
"300", "Commercial",
"3000", "Commercial",
"400", "Industrial",
"901", "Exempt Property",
'other');
out_str += '\n' + Ucode + ' - ' +round(number(int_dict[d])/(total)*leng,2)+" Ft"
}}
return out_str