gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 22:27:39 24 4
gpt4 key购买 nike

我不明白为什么我的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com