ggd*_*gdx 3 postgresql postgis
我正在努力让一个简单的 Postgresql/Postgis 语句工作,我需要一个多边形内的所有点(在这种情况下是一个矩形)
SELECT * FROM points_table WHERE ST_Contains( ST_GEOMFROMTEXT('POLYGON((51.8121, 0.13712199999997665, 51.9078, 0.21444399999995767))'), points_table.geom)
Run Code Online (Sandbox Code Playgroud)
错误读取
ERROR: function st_contains(geometry, geography) does not exist
LINE 1: SELECT * FROM points_table WHERE ST_Contains( ST_GEOMFRO...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
********** Error **********
ERROR: function st_contains(geometry, geography) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Character: 38
Run Code Online (Sandbox Code Playgroud)
这个问题的答案表明我的陈述是正确的。
似乎您在比较 GEOMETRY 和 GEOGRAPHY
如您的消息错误 st_contains(geometry, geography)
确保您的列 points_table.geom 是有效的 GEOMETRY 数据类型,而不是 GEOGRAPHY 数据类型。
例如假设您使用 SR 4326
SELECT *
FROM points_table
WHERE ST_Contains(
ST_Transform(
ST_GEOMFROMTEXT('POLYGON((51.8121, 0.13712199999997665, 51.9078, 0.21444399999995767))')
,4326)
, points_table.geom)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4034 次 |
| 最近记录: |