Hi,
I am having trouble with the intersects function in trying to get it to return the value of the "correct" polygon when two or more are overlapping. Currently I have two polygon layers, one of cells and one of country boundaries. I have my code written down to tell me the country information when a cell is overlapping only one country. But when a cell overlaps with two or more countries I am struggling to find a way to get it to iterate out and choose the one with the greatest overlap.
This is the code I am as of now working with.
var country = FeatureSetByName($datastore, "Ref_Map", country, true)
var map_intersect = Intersects(country, $feature)
var intcnt = Count(map_intersect)
if intcnt == 0{
result = 'Global'
}else{
for (var contry_code in map_intersect){
var result = contry_code.genc3}
}
return result