简体   繁体   English

postgis-在ST_POINT中使用字段名称

[英]postgis - using field name in ST_POINT

I'm trying to run this: 我正在尝试运行此:

SELECT 
    * 
FROM 
    creator.maps 
WHERE 
    ST_DISTANCE( 
        ST_POINT(10,10)::geography, 
        ST_POINT(geolocation)::geography 
    ) 
    < 50000;

But it's giving me the error: 但这给了我错误:

HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

geolocation is a POINT type 地理位置是POINT类型

How do I fix this? 我该如何解决?

Error: 错误:

ERROR:  function st_point(point) does not exist

The type point can be converted to a PostGIS geometry first, then to a geography . 可以先将类型point转换为PostGIS geometry ,然后再转换为geography

SELECT 
    * 
FROM 
    creator.maps 
WHERE 
    AND ST_DISTANCE( 
          ST_POINT(10,10)::geography, 
          geolocation::geometry::geography 
      ) 
      < 50000;

Note that Postgres native geometric functions are fairly limited so you may want to consider storing data as geometry(point) instead of point 请注意,Postgres本机几何函数相当有限,因此您可能需要考虑将数据存储为geometry(point)而不是point

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM