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