MYSQL空间查询 - 返回包含来自单独表的点的多边形

时间:2022-09-23 12:11:22

I'm new to MYSQL spatial functions. I have successfully created a database with 2 tables:

我是MYSQL空间函数的新手。我已经成功创建了一个包含2个表的数据库:

CREATE TABLE polys (poly POLYGON);
CREATE TABLE points (point POINT);

and have filled them with some test data (some points overlapping polygons, some not, some polys contain no points).

并且已经填充了一些测试数据(一些点重叠多边形,一些不重叠,一些多边形不包含点)。

What would be the most efficient query to return both the polygons that are overlapped by any point, and a list of the points that are overlapping for each polygon? Is this possible in one query?

什么是最有效的查询返回任何点重叠的多边形,以及每个多边形重叠的点列表?这可能在一个查询中?

Many thanks

1 个解决方案

#1


0  

Take a look at MBROverlaps.

看看MBROverlaps。

MRBOverlaps(geometry1,geometry2) results in 1/0 if they overlap or not.

MRBOverlaps(geometry1,geometry2)如果重叠或不重叠,则结果为1/0。

Have a look at the docs.

看看文档。

#1


0  

Take a look at MBROverlaps.

看看MBROverlaps。

MRBOverlaps(geometry1,geometry2) results in 1/0 if they overlap or not.

MRBOverlaps(geometry1,geometry2)如果重叠或不重叠,则结果为1/0。

Have a look at the docs.

看看文档。