欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

MySQL5.6将对空间字段geometry运算全面支持_MySQL

程序员文章站 2022-05-09 20:46:27
...
bitsCN.com

还是做数据库迁移。

还是从MSSQL迁移到MySQL,数据迁移过去了,最大的问题就在于MySQL不支持空间运算。最初我的打算是用MySQL连接C,然后用C去连接Postgres,然后由Postgres的Postgis插件运算后,返回结果。纠结了两天,堆了一天代码失败,返回始终为NULL,万般无奈下,翻看MySQL文档,查到在5.6中即将支持精确的空间运算,十分高兴,立马下载其测试版,试用,果然好用。纠结结束,分享链接:

http://dev.mysql.com/doc/refman/5.6/en/functions-for-testing-spatial-relations-between-geometric-objects.html

注意其中的NOTE,亮点在于:

NoteMySQL originally implemented these functions such that they used object bounding rectangles and returned the same result as the corresponding MBR-based functions. As of MySQL 5.6.1, corresponding versions are 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.As of MySQL 5.6.1, there are also ST_ aliases for existing spatial functions that were already exact. For example,ST_IsEmpty() is an alias for IsEmpty() bitsCN.com