简体   繁体   English

Object 在 100 m 距离内,错误:对混合 SRID 几何图形的操作

[英]Object in 100 m distance, Error: Operation on mixed SRID geometries

I perform the following query:我执行以下查询:

SELECT * FROM "houses" WHERE (ST_Distance(coordinates, 'POINT(-0.374930 39.478400)'::geometry) < 100)

To find houses around 100 meter distance from: 39.478400, -0.374930查找距离 100 米左右的房屋:39.478400, -0.374930

I'm getting the following error:我收到以下错误:

PG::InternalError: ERROR: Operation on mixed SRID geometries

What is wrong here?这里有什么问题?

"Coordinates" is of type: geometry "coordinates", limit: {:srid=>4326, :type=>"geometry"}

Thank you and Happy Christmas谢谢你,圣诞快乐

The geometry literal 'POINT(-0.374930 39.478400)'::geometry has no SRID while the geometries in houses.coordinates have an SRID of 4326 .几何文字'POINT(-0.374930 39.478400)'::geometry没有 SRID,而houses.coordinates中的几何图形的 SRID 为4326 You need to pass a geometry with the same SRID, ie using ST_GeomFromText :您需要传递具有相同 SRID 的几何图形,即使用ST_GeomFromText

...
WHERE ST_Distance(coordinates, ST_GeomFromText('POINT(-0.374930 39.478400)', 4326)) < 100

But keep in mind, that the distance is returned in units of the SRID, which are degrees for SRID 4326 not meters .但请记住,距离以 SRID 为单位返回,对于 SRID 4326 是度数,而不是 To retrieve the distance in meters you could use ST_DistanceSphere .要检索以米为单位的距离,您可以使用ST_DistanceSphere

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

相关问题 邮政地理信息系统 | ST_Intersects:对混合 SRID 几何图形(点,0)进行操作,=(MultiPolygon:24379)SQL 状态:XX000 - POSTGIS | ST_Intersects: Operation on mixed SRID geometries (Point, 0) != (MultiPolygon, 24379) SQL state: XX000 使用逆函数将几何转换为坐标会导致混合SRID错误 - Using inverse function with transforming geometry into coordinates results into mixed SRID error Postgis中的2个点之间的距离,以43米为单位的srid 4326 - Distance between 2 POINTs in Postgis in srid 4326 in metres 在具有不同SRID的两个GEOMETRIES上进行操作 - Operation on two GEOMETRIES with different SRIDs 触发器中的混合 SRID 阻止 qgis 提交更改 - Mixed SRID's in trigger stopping qgis from committing changes 为什么 ST_MakeValid() 会从已定义的几何图形中去除 SRID? - Why does ST_MakeValid() strip SRID from already-defined geometries? 如何添加 2 个点和它们之间的距离 (SRID = 32636)? - How to add 2 points with distance between them (SRID = 32636)? 查询以查找PostgreSQL中连续行的几何之间的距离 - Query for finding the distance between geometries from consecutive rows in postgreSQL 获取几何的外环,并将其放入geojson对象-Postgis-SQL - Get exterior ring of geometries, and put it in geojson object - Postgis - SQL 如何在Postgis中更改SRID - How to change SRID in Postgis
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM