Select to view content in your preferred language

Pop up with intersecting feature concatonate

391
7
Jump to solution
09-10-2024 05:02 AM
Labels (2)
MicahWarnock1
Occasional Contributor

I am creating a Floodplain information application for residents to review their pending floodplain change proposals.  Ive created pop up showing the property information and intersecting floodplain information.  I can get the first floodzone classification the parcel intersects, but I want to identify all the floodzone classifications the parcel intersects concatonated(ex: A, AE, VE, X ect...) Ive tried to use the below code but it doenst return any infoformation.  I also dont want it to return redundant zones(ex: A, VE, A, X,X).

var FLDZN = Contains($feature,FeatureSetByName($map,"Flood Hazard Area"))

var FLDZN_list = []
for (var f in FLDZN){
    Push(FLDZN_list, f.OFFICIAL_N)
   
}
return Concatenate(FLDZN_list, '\n')
 
Thanks in advance for advice!
0 Kudos
1 Solution

Accepted Solutions
MicahWarnock1
Occasional Contributor
Thanks Ken,  Like last time, in the code box, I see no warningas and it appears to work. However, When I dentifying a parcel, The information shows like there is nothing.  As you can see in the picture,  The property is intersecint zones AE & XS
 
var FLD_ZONE = Contains($feature,FeatureSetByName($map,"Flood Hazard Area"))
var FLD_ZONE_list = []
for (var f in FLD_ZONE){
  if (!Includes(FLD_ZONE_list, f.Captureaction)) Push(FLD_ZONE, f.Captureaction)
}

return {
  type : 'text',
  text : Concatenate(FLD_ZONE_list, '<br/>')
}
 
I also included the flood layer table in the screen shot for collumn verification.  Im happy to send you the MapService URL but prefer ofver private email.  Thanks again for your help
 MicahWarnock1_6-1725975562636.png

 

 

 

MicahWarnock1_2-1725975198754.png

 

View solution in original post

0 Kudos
7 Replies
KenBuja
MVP Esteemed Contributor

Your code works in testing (using an Arcade element) on my data. I've added the extra check so there aren't any duplicates

var FLDZN = Contains($feature,FeatureSetByName($map,"Buildings"))
var FLDZN_list = []
for (var f in FLDZN){
	if (!Includes(FLDZN_list, f.Captureaction)) Push(FLDZN_list, f.Captureaction)
}

return { 
	type : 'text', 
	text : Concatenate(FLDZN_list, '<br/>')
}

 

Snag_2ff70d.png

0 Kudos
MicahWarnock1
Occasional Contributor
Thanks Ken,  Like last time, in the code box, I see no warningas and it appears to work. However, When I dentifying a parcel, The information shows like there is nothing.  As you can see in the picture,  The property is intersecint zones AE & XS
 
var FLD_ZONE = Contains($feature,FeatureSetByName($map,"Flood Hazard Area"))
var FLD_ZONE_list = []
for (var f in FLD_ZONE){
  if (!Includes(FLD_ZONE_list, f.Captureaction)) Push(FLD_ZONE, f.Captureaction)
}

return {
  type : 'text',
  text : Concatenate(FLD_ZONE_list, '<br/>')
}
 
I also included the flood layer table in the screen shot for collumn verification.  Im happy to send you the MapService URL but prefer ofver private email.  Thanks again for your help
 MicahWarnock1_6-1725975562636.png

 

 

 

MicahWarnock1_2-1725975198754.png

 

0 Kudos
KenBuja
MVP Esteemed Contributor

I was using a field name in my data (Captureaction), but you must use your field name (OFFICIAL_N). Can you send it to me through Messages?

0 Kudos
MicahWarnock1
Occasional Contributor

No 100% sure what messages are.  I don’t get on these boards much.. Sorry.  But happy to take direction. Feel free to message me or reply a quick how to message you. I changed the "Captureaction" to my attribute column, its called FLD_ZONE see code. The pop up looks like the picture below. and it didn’t actual create a list.. as the identified parcel show "XS" and it should be "XS, AE"1

MicahWarnock1_0-1725986589893.png

 

var FLDZN = Contains($feature,FeatureSetByName($map,"Flood Hazard Area"))

var FLDZN_list = []

for (var f in FLDZN){

  if (!Includes(FLDZN_list, f.FLD_ZONE)) Push(FLDZN_list, f.FLD_ZONE)

}

 

return {

  type : 'text',

  text : Concatenate(FLDZN_list, '<br/>')

}

 

Also my plan is to make a popup like below, not table pop up and actual dynamic one.. I’ve made them before with attribute expression then added then added the expression to a text popup.

MicahWarnock1_1-1725986589897.png

 

 

0 Kudos
KenBuja
MVP Esteemed Contributor

The Contains function will return the list of features that are completely within the feature, which won't happen with most of the flood zones. Instead, you'll want to use the Intersects function.

var FLDZN = Intersects(FeatureSetByName($map, "Flood Hazard Area"), $feature);
var FLDZN_list = [];
for (var f in FLDZN) {
  if (!Includes(FLDZN_list, f.FLD_ZONE)) Push(FLDZN_list, f.FLD_ZONE);
}

return {
  type: "text", 
  text: Concatenate(FLDZN_list, "<br/>")
};

BTW, if you include code in your messages, you should use the "Insert/Edit code sample" button.

0 Kudos
MicahWarnock1
Occasional Contributor
Thanks! This worked!
0 Kudos
KenBuja
MVP Esteemed Contributor

Glad to help. Don't forget to click the "Accept as Solution" button to the post(s) that answered your question.

0 Kudos