mysql 空间查询错误:GeometryFromText does not exist

GeometryFromText 不存在或者语法错误

错误信息例如:

SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION erp_php.GeometryFromText does not exist (SQL: insert into `contract_ele_area` (`prov_ext_id`, `city_ext_id`, `area_ext_id`, `is_sole`, `agent_level`, `project_id`, `product_id`, `address`, `lon`, `lat`, `point`, `start_date`, `end_date`, `updated_id`, `status`, `created_id`, `cont_ele_id`, `updated_at`, `created_at`) values (370000000000, 370800000000, 370881000000, 2, 0, 120201, 12020102, , 116.991885, 35.592788, GeometryFromText('POINT(116.991885 35.592788)'), 2013-06-01 00:00:00, 2016-05-31 00:00:00, 0422291949844204, 2, 0422291949844204, 1, 2020-07-07 16:34:30, 2020-07-07 16:34:30))

GeometryFromText()函数来将字符串格式的空间点坐标转化为Geometry类型
查看mysql的版本号 数据库版本号
原因:
mysql版本号在8.0以后 修改了GeometryFromText()函数命名

解决方法:
统一在GeomFromText()前面加ST_,也就是ST_GeometryFromText(‘POINT(经度 纬度)’)

参考资料:
https://blog.csdn.net/sinat_34326100/article/details/103447418
https://blog.csdn.net/MoFengLian/article/details/89670133
https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值