postgresql - SELECT FROM 查询与 PostGIS 几何不工作
问题描述
我有以下查询:
SELECT "coordinate" FROM "chunk" WHERE "coordinate"=ST_SetSRID(ST_MakePoint(1, 1), 4326)
在这里,我想从一个块中选择坐标为 (1,1) 的所有行,但出现以下错误:
SQL Error [42883]: ERROR: operator does not exist: point = geometry
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
Position: 52
我很高兴看到任何可以帮助我解决这个问题的东西。先感谢您。
解决方案
如果你想在 sql 的“where”部分搜索坐标,你应该使用 st_astext 函数
这是示例 sql 查询
select st_astext(coordinate),coordinate
from (
select
1 as id,
ST_SetSRID(ST_MakePoint(1, 1), 4326) as coordinate
) "chunk"
where st_astext(coordinate)='POINT(1 1)'
推荐阅读
- merge - 在 SNOWFLAKE 中进行横向展平时重复主键
- angular - 角度嵌套导航和路由器插座
- python - 在 Replit 中保存游戏并加载以从保存的位置开始
- jquery - 查找完全没有属性的元素
- javascript - 尽管之间有内容,为什么 Textarea 是空的
- api - 您无权访问“http://us-south.assistant.watson.cloud.ibm.com”
- c++ - 在 0 到 100 之间进行简单的猜谜游戏,但猜中 2 次后游戏结束
- grails - 使用 Grails 4/5 在已部署的应用程序中重新加载 gsp
- proxy - SonarQube Scanner 的 Jenkins 工具的自动安装似乎忽略了 Jenkins 的代理设置
- python - 硒文本选择的异常索引问题