简体   繁体   English

Mysql:ST_包含带有边框以检测多面体是否包含点

[英]Mysql: ST_Contains with borders to detect if multipolygon contains point

I use mysql spatial functions. 我使用mysql空间函数。

I have to understand if points lies withing multipolygon. 我必须了解点是否与多多边形有关。
Initially I used MBRContains but it works in a strange way, so I faced the following error: Mysql function MBRContains is not accurate 最初,我使用MBRContains但是它以一种奇怪的方式工作,所以我遇到了以下错误: Mysql函数MBRContains不正确

在此处输入图片说明

My next step was switching to the functions ST_Contains . 我的下一步是切换到功能ST_Contains But I found out that if I use polygon(from multipolygon) vertex as argument - function returns false but I want to unclude all multipolygon borders. 但是我发现,如果我使用来自多边形的多边形作为参数,函数将返回false,但是我想取消所有多边形的边界。

PS 聚苯乙烯

I found that where are function: 我发现函数在哪里:

ST_Touches(g1, g2) ST_Touches(g1,g2)

Two geometries spatially touch if their interiors do not intersect, but the boundary of one of the geometries intersects either the boundary or the interior of the other 如果两个几何的内部不相交,则两个几何在空间上接触,但是其中一个几何的边界与另一个的边界或内部相交

Looks like it works like I want(in OR conditions with ST_contains ) but documentation is not clear for me. 看起来像我想要的那样工作(在ST_contains OR条件下),但文档对我来说并不明确。 Can you explain how can 2 conditions be truth together 你能解释两个条件如何一起成为真理吗
1. Interiors do not intersects 1.内部不相交
2. Boundary intersects the interrior. 2.边界与边界相交。

?

Question: 题:

How can I achieve the behaviour I want? 如何实现我想要的行为?

看起来像工作解决方案:

ST_Contains(g1,g2) || ST_Touches(g1, g2)

看起来ST_Distance(AREA, @point)) = 0包含边框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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