无法在MySQL中插入GeomFromText('POINT(..)') [英] Cannot insert GeomFromText('POINT(..)') in MySQL
问题描述
我创建了一个数据库,其中一个表存储某些点的地理位置。
我试图填充该表,其中先验似乎很容易与 GeomFromText('POINT(39.48280 -0.34804)')
,但它不工作。所有其他列,如ID,名称...确实得到它们的值,但位置列保持空。
然后我尝试更新我所在的行只需添加:
更新`pfc_db`.`poi`
SET
`位置`= GeomFromText ('POINT(39.48280 -0.34804)')
WHERE id ='poi00001';
并且MySQLWorkbench显示它的输出:
0行受影响
行匹配:1更改:0警告:0
为什么它找到它需要更新的行,但是不行?如果我尝试更新另一列,它的工作原理是完美的,但与位置无关。
我一直在搜索解决方案,我发现像 MySQL INSERT / UPDATE on POINT column ,我试过了所提出的解决方案,但仍然没有任何结果。
所以,任何人都知道我在做什么错?
感谢您的阅读。
b $ b我不知道为什么,但MySQLWorkbench GUI没有显示Point变量,至少在我的计算机中。然后我试着从php脚本中查询数据库,并且它完美地打印了这些点,所以数据库实际上存储了它们。这只是一个GUI显示问题。我应该将它作为MySQL的错误报告吗?
I've created a database where one of the tables stores the geolocation of some points.
I'm trying to fill that table, which a priori seems pretty easy with GeomFromText('POINT(39.48280 -0.34804)')
, but it doesn't work. All the other columns, like id, name... do get their values, but the location column remains empty.
So then I try to update the row I've just added with:
UPDATE `pfc_db`.`poi`
SET
`location` = GeomFromText('POINT(39.48280 -0.34804)')
WHERE id = 'poi00001';
And MySQLWorkbench shows its output:
0 row(s) affected
Rows matched: 1 Changed: 0 Warnings: 0
Why does it find the row it has to update but doesn't do it? If I try to update another column it works perfect, but not with the location.
I've been googling for a solution, I've found posts like MySQL INSERT/UPDATE on POINT column and I've tried the proposed solutions but still nothing.
So, anyone knows what I'm doing wrong?
Thanks for reading.
I don't know why but the MySQLWorkbench GUI didn't display the Point variables, at least in my computer.
Then I tried to query the DB from a php script and it printed the Points perfectly, so the DB actually stored them. It was just a GUI display problem. Should I report it as a bug to MySQL?
这篇关于无法在MySQL中插入GeomFromText('POINT(..)')的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!