ST_Distance_Sphere postgis 报错问题

在根据其他博客学习PostGIS时,执行SELECT p1.name,p2.name,ST_Distance_Sphere(p1.the_geom,p2.the_geom) FROM cities AS p1, cities AS p2 WHERE p1.id > p2.id;

一直报错:

ERROR:  function sST_Distance_Sphere(geometry, geometry) does not exist
LINE 1: SELECT p1.name,p2.name,st_distance_sphere(p1.the_geom,p2.the...
                               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

找各种原因:最终发现,可能是版本原因, 将ST_Distance_Sphere改成ST_DistanceSphere就行!

猜你喜欢

转载自blog.csdn.net/qq_37061368/article/details/110661622