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