I'm trying to use the geospatial extensions for the first time. The basic idea
is to track points and see if they fall within rectangles, so the core work that
the database is doing is a query that involves MBRWithin.
It mostly works, but sometimes it doesn't when I think it should. Here's an
example:
mysql> Set @g1 = GeomFromText('Point(37.4324379 -122.1529999)');
Query OK, 0 rows affected (0.00 sec)
mysql> Set @g2 = GeomFromText('Polygon((37.428 -121.1575,37.428 -121.1485,37.437
-121.1485,37.437 -121.1575,37.428 -121.1575))');
Query OK, 0 rows affected (0.00 sec)
OK, but I know that the text doesn't get interpreted for legal syntax at this
point, so I check:
mysql> select astext(@g1);
+--------------------------------+
| astext(@g1) |
+--------------------------------+
| POINT(37.4324379 -122.1529999) |
+--------------------------------+
1 row in set (0.00 sec)
mysql> select astext(@g2);
+-------------------------------------------------------------------------------------------------+
| astext(@g2) |
+-------------------------------------------------------------------------------------------------+
| POLYGON((37.428 -121.1575,37.428 -121.1485,37.437 -121.1485,37.437
-121.1575,37.428 -121.1575)) |
+-------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
Looks the same, hooray.
mysql> select mbrwithin(@g1, @g2);
+---------------------+
| mbrwithin(@g1, @g2) |
+---------------------+
| 0 |
+---------------------+
1 row in set (0.00 sec)
mysql> select mbrwithin(@g2, @g1);
+---------------------+
| mbrwithin(@g2, @g1) |
+---------------------+
| 0 |
+---------------------+
1 row in set (0.00 sec)
I may be being an idiot, but ... it sure looks to me as if @g1 lies smack in the
center of @g2 (since that's how @g2 was computed!). I know that the syntax of
the geospatial stuff is very picky, so maybe I've got something wrong there.
I'm running 5.0.67-community-nt ... are there any bugs in this stuff? I didn't
find anything in the bug database.
Oddly enough, some other similar queries work as expected, so I'm at a loss.
Help?
Thanks,
chris
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]