【发布时间】:2020-12-01 23:33:52
【问题描述】:
在 MySQL v.8.0 中学习 SPATIAL 数据期间,在 page 的文档中发现错误。 这个查询:
SET @json = '{ "type": "Point", "coordinates": [102.0, 0.0]}';
SELECT ST_AsText(ST_GeomFromGeoJSON(@json));
应该用这个轴顺序返回 WKT:
POINT(102 0)
但是,它返回这个顺序:
POINT(0 102)
也许我犯了一些错误,等待您的帮助。
小提琴https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=b5a9de67da72e55cc43c6752920616f4.
【问题讨论】:
-
空间坐标在 WKT 中按
(latitude, longitude)的顺序编码(我只在用户手册中找到间接参考 - 但我搜索时疏忽了),但在 GeoJSON 中按倒序编码 (tools.ietf.org/html/rfc7946#section-3.1.1)。跨度>