开发者

what is the MySQL function wchih is equavalent to DB2/PostGIS function "ST_Intersection"?

I'm doing some performance comparison between DB2/MySQL spatial functions. However after I translate the DB2 spatial queries into MySQL dialect, it complains about syntax error (ERROR: Function Intersection does NOT exist). The query is pretty simple as shown below:

SELECT Area(Intersection(a.outline, b.outline) )/Area(Union( a.outline, b.outline)) AS area_ratio,  Distance(Centroid(b.outline), Centroid(a.outline) ) AS centroid_distance
FROM spatial_table1 A, spatial_table2 B  ............

After looking into documentation, I found the precise spatial functions (Intersection,开发者_StackOverflow社区 Union) are NOT implemented in MySQL. Is that so ? Is there a workaround for this ?


MBRIntersects()

It not 100% the same because it tests to see if the bounding rects intersect, but it's close.

MySQL docs: http://dev.mysql.com/tech-resources/articles/4.1/gis-with-mysql.html
Geometry functions in MySQL: http://dev.mysql.com/doc/refman/5.0/en/geometry-property-functions.html

Note that only MyISAM tables support spatial indexes.

UDF's for GIS, not useful for your question sorry:
MySQL UDF for distance on a sphere: http://www.lenzg.net/archives/220-New-UDF-for-MySQL-5.1-provides-GIS-functions-distance_sphere-and-distance_spheroid.html
MySQL UDF for UTM functions: http://www.mysqludf.org/lib_mysqludf_fPROJ4/index.php


There is a development snapshot which comes with the precise spatial functions implemented by "Holyfoot". It's the 5.1.35 snapshot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜