简体   繁体   English

Postgis ST_DWithin匹配特定半径AND右边的点

[英]Postgis ST_DWithin match a certain radius AND points on the right

I'm using postgis 9.1 and rgeo to develop an map application. 我正在使用postgis 9.1和rgeo开发地图应用程序。

One of the features implies that I find all points that are XXX kms from the current point, and are also on the right of the Point. 其中一项功能意味着我找到了距当前点XXX公里,并且也在该点右侧的所有点。

I tried with the following query: 我尝试使用以下查询:

Environment.where{ st_dwithin(location, factory.point(170.0, 0), 300000 ) }.where('ST_X(location::geometry) > 170')

The corresponding SQL for the query: [EDITED] SELECT "environments".* FROM "environments" WHERE (st_dwithin("environments"."location", ST_PointFromText('POINT(170 0)', 4326), 300000)) AND (ST_X(location::geometry) > 170 ); 查询的相应SQL:[EDITED] SELECT "environments".* FROM "environments" WHERE (st_dwithin("environments"."location", ST_PointFromText('POINT(170 0)', 4326), 300000)) AND (ST_X(location::geometry) > 170 );

Here I hardcoded the point to be in the 170 longitude. 在这里,我将点硬编码为170度。

The problem with this is that I can't match points in the [-170,-180] longitudes. 问题是我无法匹配[-170,-180]经度中的点。

Is there a way to solve this using only postgis functions? 有没有办法仅使用postgis函数来解决此问题?

[EDIT] This is a around the world problem with postgis. [编辑]这是Postgis的全球性问题。 In this application I'm allowed only to find points to the right and in a certain range.. I can't find a solution with pure SQL... 在此应用程序中,我只能在正确的位置和一定范围内找到点。.我找不到使用纯SQL的解决方案...

Thanks! 谢谢!

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

相关问题 为什么 PostGIS 将所有点堆叠在一起? (使用 ST_DWithin 查找半径 1000m 内的所有结果) - Why is PostGIS stacking all points on top of each other? (Using ST_DWithin to find all results within 1000m radius) BigQuery ST_DWITHIN 多点与多点 - BigQuery ST_DWITHIN multiple points with multiple points 使用填充有PostGIS WKB坐标的Postgres array []会导致“函数st_dwithin(文本,几何,整数)不是唯一的” - Using a Postgres array[] filled with PostGIS WKB coordinates results in “function st_dwithin(text, geometry, integer) is not unique” 按结果出现的半径数将结果按ST_DWith排序 - Rank order ST_DWithin results by the number of radii a result appears in 如何使用ST_DWithin查找近点? - How to use ST_DWithin to find near point? 基于st_dwithin条件的BigQuery Left Join就像一个内部联接 - BigQuery Left Join based on st_dwithin condition acting like an Inner Join PostGis在距线一定距离的多个表中查找点 - PostGis find points from multiple tables in certain distance from line 在PostgreSQL上使用PostGIS扩展,为什么`ST_ConvexHull`不包含所有创建它的点? - Using PostGIS extensions on PostgreSQL, why doesn't `ST_ConvexHull` contain all points that create it? PostGIS 2.3按点分割 - PostGIS 2.3 Split a line by points Postgis计算点之间的距离 - Postgis calculate the distance between points
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM