mysql - 为什么 POINT() 被存储为 ??*??E@z?3M??Q?在 mysql 表中

标签 mysql sql database gis point

我不明白为什么我的 MySQL GIS 中的 POINT 数据类型被插入为 ??*??E@z?3M??Q?

我的代码如下。任何帮助将不胜感激,我花了很长时间修补和阅读文档。先感谢您!

我的查询:

insert into locations values(null, POINT(43.005895, -71.013202), 'Car wash');

我的 table :

CREATE TABLE locations (
  location_id int(10) unsigned NOT NULL AUTO_INCREMENT,
    coordinates point NOT NULL,
    name varchar(20) NOT NULL,
  PRIMARY KEY (location_id)
     ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1

最佳答案

您可以使用 ST_AsText() 将 GIS 数据从内部格式转换为 WKT 字符串:

SELECT location_id, ST_AsText(coordinates) as coordinates, name
FROM locations

关于mysql - 为什么 POINT() 被存储为 ??*??E@z?3M??Q?在 mysql 表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34754787/

相关文章:

Mysql OR/AND 查询

c++ - QSqlQuery size() 总是返回 -1

mysql - 不同数据库类型的示例数据库模式

mysql转储: Got error: 1017: Can't find file: './access.frm' (errno: 13) when using LOCK TABLES

php - 帮助建立图片库数据库

php - Doctrine2 Cascade的正确使用

php - 在 mysql 中显示开始日期和结束日期之间的日期

php - Mysql - 在一个字段标题下显示多行

mysql - SQL - 选择最常出现的值

mysql - 获取mysql中的多行和单行