SPATIAL_REL_CONTAINS or SPATIAL_REL_INTERSECTS

480
2
Jump to solution
05-23-2019 07:39 AM
DeanWilson
New Contributor III

Good morning!

I'm trying to get this spatial query right, and as per the subject above, whats the difference between SPATIAL_REL_CONTAINS or SPATIAL_REL_INTERSECTS?  If spatial_rel_contains is for one polygon that's completely contained in another polygon, why does the description read "Part or all of a feature from feature class 1 is contained within a feature from feature class 2." ? Here's why I ask this....

I have a parcel geometry.  I'm trying to find out what survey area its in using the survey area geometry.  Well, when I use intersects, I'm getting 4 different survey areas.  It should only be showing one survey area that its in.  Here's the rub.  When I use contains instead of intersects, it doesn't find ANY SURVEY AREAS.  Isn't contains supposed to be able to allow for partial contains?  Here's how I'm putting my function together (I know I have the contains commented out.  So right now its using intersects and not contains):

_fetchVMSData: function(){
     let vmsQuery = new Query();
     vmsQuery.geometry = features[0].geometry;
     //vmsQuery.spatialRelationship = Query.SPATIAL_REL_CONTAINS;
     vmsQuery.outFields = ["VMS", "SEC_NUM", "TOWNSHIP", "RANGE"];

    let vmsQueryTask = new        QueryTask("https:// service where the survey geometries are");
return vmsQueryTask.execute(vmsQuery);
}
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Dean,

   They are pretty much what their title suggests. SPATIAL_REL_CONTAINS means the whole feature has to be contained inside of other geometry where as SPATIAL_REL_INTERSECTS means any portion of the geometry can intersect (touch) the other geometry.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Dean,

   They are pretty much what their title suggests. SPATIAL_REL_CONTAINS means the whole feature has to be contained inside of other geometry where as SPATIAL_REL_INTERSECTS means any portion of the geometry can intersect (touch) the other geometry.

DeanWilson
New Contributor III

What threw me in the description of the SPATIAL_REL_CONTAINS, it says "Part or all of a feature from feature class 1...".  So I just ended up using the intersects relationship and just adding a negative buffer of a foot to the geometry I was using.  It seems to work ok now.  Thanks for clearing that up for me though, Robert.  I think ESRI needs to update the description of SPATIAL_REL_CONTAINS.    

--Dean

0 Kudos