Bug #23964 GIS - full spatial support
Submitted: 3 Nov 2006 21:01 Modified: 6 Jul 2012 19:05
Reporter: Ulf Küßner Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: GIS Severity:S4 (Feature request)
Version:5.1 OS:Any (all)
Assigned to: Assigned Account CPU Architecture:Any
Tags: gis, MBR, Spatial tables

[3 Nov 2006 21:01] Ulf Küßner
Description:
It seems Mysql still won't support full OpenGIS feature comparability. As spatial tables that are using soely MBR functionality are mostly useless, I'd like to see full support for spatial functions 'contains' 'intersects', 'contains','crosses', 'disjoint', 'distance', 'Equals', 'Overlaps', 'Touches', 'Within' 

How to repeat:
simply try
mysql> select Distance( PointFromText( 'Point(0 0)' ), PointFromText( 'Point(180 0)' ) );
ERROR 1305 (42000): FUNCTION .Distance does not exist

or contains:
mysql> SET @g1 = GeomFromText('Polygon((0 0, 1 0, 0.1 0.5, 1 1, 0 1, 0 0))');
mysql> SET @g2 = GeomFromText('Point(1 0.5)');

SELECT Contains(@g1,@g2), MBRContains(@g1,@g2);
+-------------------+----------------------+
| Contains(@g1,@g2) | MBRContains(@g1,@g2) |
+-------------------+----------------------+
|                 1 |                    1 | 
+-------------------+----------------------+
1 row in set (0.00 sec)

first column should be false, the second of course, true.

Suggested fix:
implement polygon functionality and geographic projections
[25 Nov 2007 16:23] Alexey Botchkov
As precise GIS functions code isn't included into main trees yet, one
has to get the separate GIS tree to get these working.
Check this page for links:
http://forge.mysql.com/wiki/GIS_Functions
[6 Jul 2012 19:05] Alexander Barkov
Precise GIS operations were implemented in 5.6.
[18 Jul 2012 14:51] Santo Leto
From Page "What Is New in MySQL 5.6" (http://dev.mysql.com/doc/refman/5.6/en/mysql-nutshell.html):

"OpenGIS.  The OpenGIS specification defines functions that test the relationship between two geometry values. MySQL originally implemented these functions such that they used object bounding rectangles and returned the same result as the corresponding MBR-based functions. Corresponding versions are now available that use precise object shapes. These versions are named with an ST_ prefix. For example, Contains() uses object bounding rectangles, whereas ST_Contains() uses object shapes. For more information, see Section 12.17.5.4.2, “Functions That Test Spatial Relationships Between Geometries”. "