地理围栏:如何使用 Oracle Spatial 查找点或形状是否在多边形内
我如何使用 Oracle 空间 SQL 查询查找一个点或多边形是否在另一个多边形内
这是场景;
我有一个表(STATE_TABLE),其中包含空间类型(sdo_geometry),它是一个多边形(比如说一个州),我有另一个表(UNIVERSITY_TABLE),其中包含空间数据(sdo_geometry)(点/多边形),其中包含大学;
现在我如何使用 SQL select 语句查找所选大学是否处于给定状态。
主要我想在地理围栏中定位给定对象的存在。
谢谢。
How do i find if a point or a polygon is inside another polygon using oracle spatial SQL query
Here is the scenario;
I have a table (STATE_TABLE) which contains a spatial type (sdo_geometry) which is a polygon (of say a State), I have another table (UNIVERSITY_TABLE) which contains spatial data (sdo_geometry) (point/polygon) which contains Universities;
Now how do i find if a selected University('s) are in a given State using SQL select statement.
Primarily i want to locate existence of given object(s) in a geofence.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将需要使用掩码为“CONTAINS”的 SDO_CONTAINS 或 SDO_RELATE
请参阅位于
SDO_CONTAINS 的文档
http://download.oracle.com/docs /cd/E11882_01/appdev.112/e11830/sdo_operat.htm#sthref1064
或
SDO_RELATE
http://download.oracle.com/docs /cd/E11882_01/appdev.112/e11830/sdo_operat.htm#i78531
您可以执行以下任一操作(假设您的空间信息包含在空间索引的名为“GEOM”的列中) ):
请原谅我,因为我没有具体记住正确的语法,而且我不知道上面的连接是否能正常工作。不过,这应该足以为您指明正确的方向。
You're going to need to use either SDO_CONTAINS or SDO_RELATE with a mask of 'CONTAINS'
Please see documentation located at
SDO_CONTAINS
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_operat.htm#sthref1064 for
or
SDO_RELATE
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_operat.htm#i78531
Either one of these you'd do something like the following (assuming your spatial information is contained in a column called 'GEOM' that is spatially indexed):
You'll have to forgive me as I don't specifically remember the correct syntax for this and I don't know if the above join will work properly at all. This should be enough to point you in the right direction though.