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

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

有帮助吗?

解决方案

Take a look at MBROverlaps.

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

Have a look at the docs.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top