[英]input geometry has unkown(0) geometry (Although st_transform is used)
I have 2 tables:我有 2 张桌子:
A table with 3 fields:包含 3 个字段的表:
id (text)
geom (geometry)
select ST_SRID(geom)
from A
where geom is not null
result: 32636
B table with 2 fields: B表有2个字段:
name (text)
geom (geometry)
select ST_SRID(geom)
from B
where geom is not null
result: 0
A.geom contains polygons A.geom 包含多边形
B.geom contains points B.geom 包含点
I want to get all the distances between A.id, A.geom and B.geom.我想获得 A.id、A.geom 和 B.geom 之间的所有距离。 I tried with:
我试过:
select id, st_distance(a.geom, ST_Transform(b.geom, 32636)) as dist
from A as a, B as b
where a.geom is not null
group by id, a.geom, b.geom
order by dist desc
But I'm getting error:但我收到错误:
"input geom has unkown(0) SRID"
How can it be if I'm using ST_Transform?如果我使用 ST_Transform 会怎样?
How can I fix it?我该如何解决?
The error message is talking about the SRID of the argument to ST_Transform
, which is 0. The message means that the function has no idea in which coordinate system the point is, so it cannot transform it to another coordinate system.错误消息是关于
ST_Transform
的参数的 SRID,即 0。该消息意味着 function 不知道该点在哪个坐标系中,因此无法将其转换为另一个坐标系。
The documentation says:文档说:
ST_Transform is often confused with ST_SetSRID .
ST_Transform 经常与ST_SetSRID混淆。 ST_Transform actually changes the coordinates of a geometry from one spatial reference system to another, while ST_SetSRID() simply changes the SRID identifier of the geometry.
ST_Transform 实际上将几何的坐标从一个空间参考系统更改为另一个,而 ST_SetSRID() 只是更改几何的 SRID 标识符。
That seems to be the case here.这里似乎就是这种情况。
You should probably use ST_SetSRID
to interpret b.geom
in SRID 32636.您可能应该使用
ST_SetSRID
来解释 SRID b.geom
中的 b.geom。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.