地理围栏:如何使用 Oracle Spatial 查找点或形状是否在多边形内

发布于 2024-10-10 06:20:56 字数 277 浏览 0 评论 0原文

我如何使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦里人 2024-10-17 06:20:56

您将需要使用掩码为“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”的列中) ):

select 
    ST.NAME, UT.UNIVERSITY_NAME
from
    STATE_TABLE ST
    INNER JOIN UNIVERSITY_TABLE UT
      ON SDO_CONTAINS(ST.GEOM, UT.GEOM) = 'TRUE'

请原谅我,因为我没有具体记住正确的语法,而且我不知道上面的连接是否能正常工作。不过,这应该足以为您指明正确的方向。

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):

select 
    ST.NAME, UT.UNIVERSITY_NAME
from
    STATE_TABLE ST
    INNER JOIN UNIVERSITY_TABLE UT
      ON SDO_CONTAINS(ST.GEOM, UT.GEOM) = 'TRUE'

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文