Select to view content in your preferred language

Can arcade Intersects be used on stacked features within the same layer?

2745
10
09-28-2021 08:29 AM
AdamGebhart
Frequent Contributor

@XanderBakker 

Is it possible to use the Intersects function to return values from stacked features (within the same feature class) in the popup?  Or is there a better method?

I have some instances of stacked polygons.  When I click those stacked polygons the popup displays the 1 of 2 or 3 and arrow over icon, similar to the image below, in the popup header. 

AdamGebhart_0-1632842749072.png

What I would like is for all stacked features' attributes to display in one popup, regardless of how many stacked features exist. condensed into one popup.  Is this possible?

Xander - I tagged you in this only because I've seen you answer other Intersects questions. 

10 Replies
XanderBakker
Esri Esteemed Contributor

Hi @AdamGebhart ,

It is possible, however, there are some things to keep in mind. With an Arcade expression, you can intersect the $feature with the $layer and access the information for all the polygons. In your example, you have 2 polygons and I assume there can be more at the same location. If you implement the expression, it will find 2 polygons and execute the expression for each polygon. It will not hide the "1 of 2" of "1 of 3" at the top of the pop-up window and when you have many polygons it can make the visualization of the pop-up window slow. 

Can you explain a bit why you have multiple stacked polygons?

0 Kudos
AdamGebhart
Frequent Contributor

Thanks for the information. 

In this case we are mapping parcels that have a water or wastewater document on file in our document management system.  A parcel could have 1, 5 or 10 documents associated with it.

The intent is to have a table of these documents joined to our parcels each night, where parcel number is the join field, so staff can see what parcels have a document or documents.  In a web app they will click a feature to view the document information and link, regardless of the number of documents for that parcel. 

We can definitely live with the "1 of 2" and arrow through the list popup and I was just curious if the Intersects could condense that down to one popup and make things a little more user friendly.  I have one other idea in mind involving a point layer (feature to points) against the parent polygon layer (just haven't tried it yet) and am open to other suggestions.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi @AdamGebhart ,

If you want to show hyperlinks in the pop-up, it is important to know that Arcade can create the list of URLs, but they won't appear as hyperlinks in the pop-in in ArcGIS Online. It will be plain text.

0 Kudos
AdamGebhart
Frequent Contributor

@XanderBakker 

Correct.  I have a few other apps where I account for the hyperlink issue via multiple expressions and use one of them in the insert hyperlink tool.  That's what I intend to do here.

My main concern lies in how to best handle the stacked features and to hopefully display all results in one popup.

0 Kudos
AnneSanta_Maria1
Deactivated User

@XanderBakker I am responding to this a tad late, but it also refers to stacked polygons or any stacked features for that matter. If you have stacked polygons, say a building with three floors, and you want to return the value of only the current floor/room on that floor shown (that might be set by the floor picker in indoors or any definition query on a feature service) is that possible with arcade. This would be a dynamic component set by the editor. So lets say I wanted to place a point on the third floor of a building in room A, but ignore all the other floors in the feature class that exist below it. If I run intersect it only returns the value on the first record in the table, or seems to ignore the user set definition query. Any suggestions?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi @AnneSanta_Maria1 ,

That is an interesting case. I haven't played with that part but it somehow feels as if this should be possible. Would it be possible to get access to (a sample of) the data? Could you share this with me using my user "xbakker.spx"?

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi @AnneSanta_Maria1 ,

First of all thanks for sharing the sample data. This helped a lot to understand what you are after. Although I also answered your direct message, I wanted to share some thoughts on this challenge here available for the rest of the community too.

When editing a point in ArcGIS Pro, the attribute rule defined on this point layer can have access to the values found in a different layer (like the rooms of a floor in a building). However, the way the attribute rule has access to the other layer is through the $datastore and the datastore is the source of the data and has no knowledge of what floor is currently visualized in a map. 

As I mentioned in my direct message, I believe the right way to go forward is to explore ArcGIS Indoors (https://www.esri.com/en-us/arcgis/products/arcgis-indoors/overview), since it comes with solutions to work with floors in a building and collect data for a specific location on a floor. 

An alternative solution in ArcGIS Pro, would be to approach this as a 3D problem. You can visualize your building in a local scene, define the base elevation (based on your elevation field), and if desired, the extrusion, based on the floor to floor height. Define a range slider based on the floor and visualize the floor where you want to create a 3D point. This will snap to the base elevation of the floor. You can use the Z value of the point to query the floor polygons and then use the Intersects function to intersect your point with the floor to obtain the room polygon. This allows you to use the information of the room directly for your point in an Attribute Rule.

Below is the Attribute Rule I used:

// get the building polygons
var building = FeatureSetByName($datastore, "Buildings_Room", ['BldRecNbr', 'Floor', 'RmRecNbr', 'RmNbr'], false);

// extract the z value of the 3D point and get a min and max value (z-1ft and z+1ft)
var z = Geometry($feature)["z"];
var zmin = z-1;
var zmax = z+1;

// create query on elevation using Z value of 3D point
var sql = "Elevation > @zmin AND Elevation < @zmax";

// filter building polygons to get floor polygons
var CurrentFloor = Filter(building, sql);

// do 2D intersection of feature with floor polygons
var intersectingrooms = Intersects(CurrentFloor, $feature);

// read out values
if (Count(intersectingrooms) > 0) {
    var intersectingroom = First(intersectingrooms);
    return{
        "result" : {
            "attributes": {
                "BldRecNbr": Right(intersectingroom.BldRecNbr, 5),
                "Floor": intersectingroom["Floor"],
                "RmRecNbr": intersectingroom.RmRecNbr,
                "RmNbr": intersectingroom.RmNbr
                }
        }
    }
}

 

...and a visualization of the result:

XanderBakker_0-1649779693692.png

 

0 Kudos
AnneSantaMaria
Deactivated User

Hi!

We are coming back to this after having implemented ArcGIS Indoors. Is this possible with ArcGIS Indoors without setting up something like contingent values where you would select the floor and then all the rooms on that floor would appear in a drop down. For mapping indoor assets it would be helpful if when placing a point in a room the building, level, and unit values were automatically populated based on the points intersection with the room on the floor that is currently displayed. I understand this might not be the best place to post this but it does give context to the question. I've tagged the indoors team and can provide further details if necessary. @JasonHine @SophieFrank 

0 Kudos
Kschilly_geo_comm
Emerging Contributor

Hi Anna- I know this is a year later but wondering if you got a solution for this? We have indoors and was wanting a similar solution. 

0 Kudos