Select to view content in your preferred language

Arcade Intersect Expression not working

736
4
06-26-2023 08:41 AM
Labels (1)
MPach
by
Occasional Contributor II

This seems like a strange issue. I have 2 lines that I'm trying to use intersect with. In the screenshot below I have a gravity main in red that is crossed by another line in blue. It might be hard to see in the screenshot, but they 100% cross. 

MPach_0-1687793787518.png

Below is the code expression that I'm using and I can't get any of these lines that I have crossing to return a value. That being said I have also tried the Crosses and Touches function and neither of those work either. I can't figure out why it won't work. I don't know  if it make a difference at all, but the capdepth (capacity depth) field I'm iterating through is a numeric field. There are no indications upon testing this expression that indicate anything is wrong with the expression. 

ar phase1 = FeatureSetById($map, 'Phase 1 -- 2025_c1dde3')

var phase1_capDepth = Intersects(phase1, $feature)

var phase1_details = ''

for(var row in phase1_capDepth) {
    phase1_details = phase1_details + row.capdepth
}

return phase1_details

Thanks

 

0 Kudos
4 Replies
jcarlson
MVP Esteemed Contributor

When using geometry-based functions in Arcade, the accuracy of the result can be based on the view scale. Can you try buffering the line by a tiny amount before intersecting? I find that sometimes helps.

- Josh Carlson
Kendall County GIS
0 Kudos
MPach
by
Occasional Contributor II

So I've tried two things and I think I'm doing it right, but I'm not sure so I'll post the code bit. First I'm trying to buffer the gravity mains, which is the layer that has the expression applied to it's pop up. 

var phase1 = FeatureSetById($map, 'Phase 1 -- 2025_c1dde3')

var buffer_ph1 = Buffer($feature, 20, 'feet')

var phase1_capDepth = Intersects(phase1, buffer_ph1)

var phase1_details = ''

for(var row in phase1_capDepth) {
    phase1_details = phase1_details + row.capdepth
}

return phase1_details

I also tried it the other way around to buffer the phase 1 line that is crossing the gravity main, but neither seems to work. I've also tired a few different buffer distances. 

var phase1 = FeatureSetById($map, 'Phase 1 -- 2025_c1dde3')

var buffer_ph1 = Buffer(phase1, 20, 'feet')

var phase1_capDepth = Intersects(buffer_ph1, $feature)

var phase1_details = ''

for(var row in phase1_capDepth) {
    phase1_details = phase1_details + row.capdepth
}

return phase1_details

Hopefully I didn't mess up my variables doing this 🤔

 I made a test file and it seems to be working in that, so I might just try to start over again. 

I do have one more question though. Is it a problem if you have multiple expressions on one layer that use Intersect to pull data from many different layers? I suppose that might be my problem. 

0 Kudos
Oliver_Sandoval_e
New Contributor III

Hi MPach, did you ever end up finding a solution?

0 Kudos
MPach
by
Occasional Contributor II

I'll let you know after I test it. Unfortunately, I got pulled on to like 3-4 other tasks before I could finish testing this. Thank you for reminding me though. 

0 Kudos