我在MySQL中使用GeoDjango。我使用models.PointField(srid=4326)对象,一切正常,数据被正确地保存并从数据库中检索,但是当我从MySQL命令行执行select * from table时,PointField字段的数据显示不可读的字符,而不是我所期望的POINT(x,y)表单。
这是正常行为吗?
发布于 2010-11-19 04:37:40
是的,这很正常。数据以二进制格式存储。
尝试使用select AsText(geom) from table,其中'geom‘是几何列的名称。
发布于 2021-09-01 10:08:36
您可以使用ST_AsText来存储点
mysql> SELECT ST_Y(Point(56.7, 53.34));
+--------------------------+
| ST_Y(Point(56.7, 53.34)) |
+--------------------------+
| 53.34 |
+--------------------------+
mysql> SELECT ST_AsText(ST_Y(Point(56.7, 53.34), 10.5));
+-------------------------------------------+
| ST_AsText(ST_Y(Point(56.7, 53.34), 10.5)) |
+-------------------------------------------+
| POINT(56.7 10.5) |
+-------------------------------------------+有关更多详细信息,请参阅链接:https://dev.mysql.com/doc/refman/8.0/en/gis-point-property-functions.html
https://stackoverflow.com/questions/3474352
复制相似问题