Experience Builder Query Widget: pass attribute query result from 1st layer as spatial filter for 2nd layer

453
13
10-06-2021 12:02 PM
Labels (1)
DavidColey
Frequent Contributor

Hello - Does anyone know how to get this to work:

  • Selected features from data source
  • Choose to return features that have a spatial relationship with features in another layer.
  • Optionally, a search distance can be applied to the geometries of the features in the related layer.

The framework doesn't seem to honor this. I just have a simple query to select one feature by attribute then want to use that result as the spatial filter "Intersects' for a second layer.  As in: Select a parcel by ID, then use that result as the spatial filter to return intersecting flood zone(s) . . . 

13 Replies
DavidColey
Frequent Contributor

So from what I can tell when setting up a spatial filter for a layer in the query widget:

For this choice:

Spatial filter>Filter by> Selected features from data source>Add filter layer>Added

The feature layer must come from another layer in another map from another page.

 

For this choice

Spatial filter>Filter by> Selected features from data source>Add filter layer>Outputs

The only valid sources appear to be the Output from a Geolocator source from the Search Widget. Selected records from a feature layer source in the Search Widget do not appear as a choice.

 

TianWen
Esri Contributor

Hi @DavidColey, I think the first choice you mentioned will work. A filter layer actually can be the same layer that is consumed by the query item. Could you provide any more detailed information or a sample app? Thanks!

0 Kudos
DavidColey
Frequent Contributor

Hi @TianWen  - well, that's the problem.  This option:

Spatial filter>Filter by> Selected features from data source>Add filter layer>Added tab

doesn't seem to work.  Nothing appears as selection set from my layers' attribute query to set as the filter for the spatial query.  The only way I can see to get it to work is when the feature layer is pulled in from another map page in the ExB or an external source...

0 Kudos
TianWen
Esri Contributor

Well, I cannot seem to reproduce the problem. I think screenshots or a sample app would help me figure it out.

0 Kudos
DavidColey
Frequent Contributor

Ok thanks @TianWen  I see.  Ok.  This is the desired work flow:

Using the Search widget,  the user queries a parcel polygon via a Parcel ID from a feature layer source.

The returned record should be visible as an Output source for the Query tool, where that geometry is then used a a spatial filter for another layer, like Zoning:

DavidColey_1-1634233618360.png

As you can see, the Parcel Layer does not show up as an available output source.  The 2 output sources that do appear are both Locator output sources.

 

0 Kudos
DavidColey
Frequent Contributor
0 Kudos
TianWen
Esri Contributor

I see the problem! Actually, Search widget will generate output data source only when it consumes geocode services. So it is as expected.

To achieve your intended goal, you can add the original Parcel layer as a filter layer in the Query. Then use a Filter widget configured with the same data. Apply filter conditions in the Filter widget, then the returned geometries are the candidates that can be used to conduct a spatial filter (select them all in your case).

DavidColey
Frequent Contributor

Hmm, ok thanks @TianWen for looking at this.  The Interaction from the help says as much:

"When configured with a locator source, the Search widget generates an output data source that can be used in other widgets. "

Although the help does not specifically say a layer source won't work, now we know.  For my use case, I may just leave as is but thanks for the tip on the Filter Widget.  I'll give it a try, re-publish and ping you . . .

0 Kudos
DavidColey
Frequent Contributor

Hi @TianWen  - I gave this a try and the output from the Filter Widget is not showing as an active or available Output Source for the Query Widget:

DavidColey_0-1634310002691.png

Am I missing something?

0 Kudos