ThinkGeo.com    |     Documentation    |     Premium Support

Spatial Query - Containing

Hi,


I'm trying to find all of the shapes that have any portion contained within a rectangle I have drawn on the map and I'm not sure how to do this with your Spatial Query API.


I want to do something very similar to what you are doing in your "Execute a Spatial Query" sample at: 


websamples.thinkgeo.com/webeditionsamples/


But when I choose containing from the drop down box nothing is highlighted.  What I would expect is that all the countries that are fully or partially contained within that rectangle would be displayed.  Am I misunderstanding something?


Thanks!



 


Clint,
 
Thanks for reporting this.
 
The sample is not very good as we don’t have a QueryType called “Containing”, we should use “Contains” instead. Also maybe a bit confusing, when you select “Containing” it gets the records which contains the rectangleShape, not get the records which contained by the RectangleShape. That’s why there is no records returned.
 
Here are all the QueryType we support:
 
QueryType.TopologicalEqual
QueryType.Disjoint
QueryType.Intersects
QueryType.Touches
QueryType.Crosses
QueryType.Within
QueryType.Contains
QueryType.Overlaps
 
And for the detail meaning, please see Page5 of JTS Topology Suite Developer’s Guide.
 
For your case, you need to use QueryType.Intersects. For any queries please let us know.
 
Ben