简体   繁体   中英

Mysql: ST_Contains with borders to detect if multipolygon contains point

I use mysql spatial functions.

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

在此处输入图片说明

My next step was switching to the functions 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.

PS

I found that where are function:

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. Can you explain how can 2 conditions be truth together
1. Interiors do not intersects
2. Boundary intersects the interrior.

?

Question:

How can I achieve the behaviour I want?

看起来像工作解决方案:

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

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

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