I created a table (community_border) in MySQL 5.5 that has some boundaries.
CREATE TABLE `municipal_border` ( `boundary` polygon NOT NULL, `municipalID` int(10) NOT NULL, ) ENGINE=InnoDB
The Municipal Field ID is not unique.
I use the following code to check if a point belongs to a polygon.
set @r = (SELECT municipal_border.boundary FROM municipal_border WHERE municipalID=9001); set @p = GeomFromText('POINT(24.1621 41.0548)'); select if(contains(@r, @p), 'yes', 'no');
The first set @r = ... statement returns only one row, and I selected it specifically for testing. It works great.
What I want to do is search the entire table (erasing, in other words, the WHERE part from the SQL query) and find which polygon the point is in.
source share