How to query polygons of a layer which do not intersect polygons of another layer using arcgis server javascript api?

868
4
Jump to solution
03-29-2019 09:34 AM
Vara_PrasadM_S
Occasional Contributor II

Hi Team,

We have two polygon feature layers with huge number of polygons. we need to query polygons of layer1 which do not intersect with any of polygons of layer2.

Could some one please tell me how to that using ArcGIS Server JS API 3.28

Robert Scheitlin, GISP‌, could you please give some insights. Thanks

Thanks in advance!

With Regards,

Vara Prasad

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Vara,

   This is a big task to do on the web. Normally large spatial queries like this against whole featurelayers is best suited from the desktop environment. If for some reason you have to do this in a web app the performance is going to be really bad. You would have to first merge all the polygons from the first layer into one multipart polygon since geometry operations work on a one geometry to one geometry basis. Then execute your spatial query for intersects and query just for the IDs of the features that do intersect once you have that result you do a SQL query with an expression like "NOT ObjectID IN (' your array or single OID')".

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Vara,

   This is a big task to do on the web. Normally large spatial queries like this against whole featurelayers is best suited from the desktop environment. If for some reason you have to do this in a web app the performance is going to be really bad. You would have to first merge all the polygons from the first layer into one multipart polygon since geometry operations work on a one geometry to one geometry basis. Then execute your spatial query for intersects and query just for the IDs of the features that do intersect once you have that result you do a SQL query with an expression like "NOT ObjectID IN (' your array or single OID')".

Vara_PrasadM_S
Occasional Contributor II

Hi Robert,

Thanks a lot!

I have same approach in my mind. I was just wondering if there is any other easy/better performance approach. Thanks for the information. Now I implemented the same.

With Regards,

Vara Prasad

0 Kudos
Vara_PrasadM_S
Occasional Contributor II

Hi Robert Scheitlin, GISP,

In below sentence you mentioned multipart polygon, is it same as creating a geometry by making union of all geometries of the layer? I did Union. Will it be same?

>>

"You would have to first merge all the polygons from the first layer into one multipart polygon since geometry operations work on a one geometry to one geometry basis"

If not, could you please let me know how can we create a multipart polygon?

Thanks & Regards,

Vara Prasad

0 Kudos
DanPatterson_Retired
MVP Emeritus

'dissolve' based on an attribute creates multipart features

0 Kudos