Intersect two featureLayers in arcgis api js

176
2
10-17-2021 06:33 AM
benchikh
New Contributor III

Hi,

I have two featureLayers (RegionsLayer and CommunesLayer) so my goal is to get only the communes under a given Region (spatial query), actually I can get a specific region with definitionExpression

 const featureLayerRegion = new FeatureLayer({
                    url: "https://xxxxxxxxxxx/arcgis/rest/services/TEST_SPATIAL/MapServer/3",
                    outFields: ["*"],
                    definitionExpression: "ID_Reg = 1",
                    popupTemplate: templateRegion
                });
 map.add(featureLayerRegion);

and now I want to get all the communes from CommuneLayer that belong to this region ?

 

0 Kudos
2 Replies
MehdiPira1
Esri Contributor

@benchikh ,

Here's the link to the API reference which shows the intersecting of 2 feature layers using geometry engine:

https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#inte...

benchikh
New Contributor III

Hi,

 

Many thanks for your reply, could you please share with me a sample of code it would be very helpful.

 

0 Kudos