Hello,
I hope to get some direction on how I can get the list of merged polygons (A+B) that intersect another polygon layer (C).
I have two polygon layer A. Municipalities and B. Regional Districts. I merged A and B into a new FeatureSet in Data Expression using common attributes such as admin type and name of the area.
Then, I want to count how many of these admin areas are affected by a weather event (polygon C), ideally returning all the names & geometry, not just count of intersects so that I can use the returned FeatureSet for further like filters.
-- This is what I did so far. The third variable (fs3) is the one need to be used to define intersect, and has not been used yet.
====================================
To post formatted code:
You can get the features intersecting a target feature with Intersects(). You would need a third loop over your merged features that intersects those features with the weather events.
But actually, it should be faster to do it the other way around:
Something like this:
var municipalities =
var districts =
var weather_events =
out_fs = {
fields: [
{name: "admin_type", type: "esriFieldTypeString"},
{name: "name", type: "esriFieldTypeString"},
],
geometryType: "",
features: []
}
for(var weather_event in weather_events) {
var i_municipalities = Intersects(weather_event, municipalities)
for(var m in i_municipalities) {
var f = {attributes: {admin_type: "Municipality", name: m.Municipality}}
Push(out_fc.features, f)
}
var i_districts = Intersects(weather_event, districts)
for(var d in i_districts) {
var f = {attributes: {admin_type: "Regional District", name: d.admin_area_name}}
Push(out_fc.features, f)
}
}
return Featureset(out_fs)