简体   繁体   中英

How to get features *not equal* to a spatial intersection?

I'm trying to get features back that are outside the intersection of themselves and a polygon defined in a query.

When I run the query with the intersection set to true (ie. =1 ) the results are normal and expected.

However, when I use the not equal to flag ( != or <> ), I get very unexpected numbers - many records per student, and even when using the distinct flag, it seems the STIntersects function isn't respected.

select 
 Students.shape
from Students
join
Boundaries
on (Points.shape.STIntersects(Boundaries.shape) !=1)
where  Boundaries.BNum = '408'

Can the STIntersects function handle this type of request?

Thanks!!!

Further to this, the STDisjoint function will return multiple records as it will test the intersection (or lack thereof) for points against multiple polygons.

So the real answer was to use the STIntersects function as a sub-selection, and basically grab all the features that are NOT IN that sub selection.

A post describing this can be found here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM