Here is what I have so far:
var intersectLayer =Intersects(FeatureSetByName($map,"PC FPs nonTidal Regulated"), $feature)
var Hazard = "";
for (var f in intersectLayer) {
if (Hazard == "") {
Hazard = f.PC_FHA
} else {
Hazard += " And " + f.PC_FHA;
}
}
return Hazard
What I am looking for next is when there's a parcel that intersects both PC_FHA_NonTidal And PC_FHA_Floodway_NonTidal, I want it to return the option with a higher risk for instance PC_FHA_NonTidal. The parcel referenced is within both areas (hatched and blue symbology) and I want to default to the higher risk flood answer (whatever it ends up being- this is for proof of concept at this stage). The end goal is to have all the risk layer intersections added to the parcel layer for customers to find out information but I am stuck when there are multiple options for a specific parcel boundaries. The popup will end up being very similar to the floodplain inquiry solution but more specific parameters because I want to default to a specific answer when multiple intersecting options are found. Does that make sense? Thank you!
Solved! Go to Solution.
Hi Allison Goldberg ,
I had a moment to think about how to avoid these redundant lines and this is what should work:
var FEMA = OrderBy(Intersects($feature, FeatureSetByName($map,"FEMASupportData - Storm Surge 2016")), "CATEGORY DES");
var cnt = Count(FEMA);
var parcelarea = AreaGeodetic($feature, "square-feet");
var result = "FEMA:";
var dct = {};
if (cnt > 0) {
for (var FEMApol in FEMA) {
var intersectarea = AreaGeodetic(Intersection($feature, FEMApol), "square-feet");
var category = Text(FEMApol.CATEGORY);
if (HasKey(dct, category)) {
dct[category] += intersectarea;
} else {
dct[category] = intersectarea;
}
}
for (var category in dct) {
var percentage = (dct[category] * 100.0) / parcelarea;
result += TextFormatting.NewLine + " - Category: " + category + " (" + Round(percentage, 2) + "%)";
}
} else {
result = "No risk detected";
}
return result;
and a visual result:
Awesome, thanks so much for everything! This is also really helpful to know how to do as the project progresses. I appreciate all your assistance. Xander Bakker
You're welcome agoldberg_Pinellas_eGIS , if you have any follow-up questions just tag me.
I was hoping you could maybe help me again for another application. I am working on an attribute expression that involves multipart features. Do I need to convert to single-part to get the desired results? I want to display all future land use options but not duplicate the values. Currently it is showing each multi-part option multiple times. Ideally I would like it (for this example) to be P/ROS/RL. Any idea how to properly format that so the value in the attribute expression occurs only one time? This is what I have so far to display all potential options but want to remove it when it show up multiple times:
var intersectLayer =Intersects(FeatureSetByName($map,"Future Land Use - Unincorporated"), $feature)
var FutureLandUse = "";
for (var f in intersectLayer) {
if (FutureLandUse == "") {
FutureLandUse = f.LANDUSECODE
} else {
FutureLandUse += " / " + f.LANDUSECODE;
}
}
return FutureLandUse
Any help would be appreciated. Can't seem to find much documentation related to this issue, only ones associated with removing duplicates for labeling. Thank you.
Could you try to include Distinct, like this?
var intersectLayer = Distinct(Intersects(FeatureSetByName($map,"Future Land Use - Unincorporated"), $feature), ["LANDUSECODE"]);
var FutureLandUse = "";
for (var f in intersectLayer) {
if (FutureLandUse == "") {
FutureLandUse = f.LANDUSECODE;
} else {
FutureLandUse += " / " + f.LANDUSECODE;
}
}
return FutureLandUse;
This should make the list of land use codes unique.
That was stupidly easy, didn't know about using "distinct". Thank you! Xander Bakker
I'm glad it worked (I understand it did). To have a look at the entire list of functions, have a look here:
Just brilliant @XanderBakker . This has saved me so much time and really opened up the possibilities with Arcade. I'm using this approach in WAB to calculate the % of intersecting area on certain vegetation types.
Our users have to create project areas that have a minimum % overlap and this will allow them to iteratively adjust their polygon boundaries until they get the desired result
Hello again Xander,
I was hoping you could assist once again. I am working with the flood customer and she wants a link embedded in the popup when a specific result is obtained. This is what I have so far but the hyperlink isn't showing up in the popup. Do I have to add it as a custom attribute display? I can get the hyperlink to show up properly when the return is just the link but when it's text and the link it just displays as text. This information is in the same web map I originally share with you but under an attribute expression called Test6 if you'd rather take a look at it there. Thank you.
var floodzone = Intersects(FeatureSetByName($map,"FEMASupportData - Storm Surge 2016"), $feature)
If(Count("CATEGORY") > 0) {
return "This property is located in a storm surge area. Get a Plan at <a href=\"https://www.flgetaplan.com\">www.flgetaplan.com</a>. Find out how much flood damage could cost you at <a href=\"https://www.floodsmart.com\">www.floodsmart.com</a>"
} Else {
return 'This property is not located in a storm surge area.'
Xander Bakker
Hi Allison Goldberg ,
Currently the return type of html is not supported (it is on the road map), so when you construct html it will be interpreted as text. The validation of Count("CATEGORY")>0 will always be true since Count("Category") will return 8 (number of characters). You could apply a Filter to the featureset before you intersect filtering all features where category is larger than 0 and then intersect it, followed by the count.
You will have to use custom html pop-up to be able to achieve this. There is an example explain here showing what you could do: https://community.esri.com/message/905592-re-arcade-text-formatting-bold-text?commentID=905592#comme...