【问题标题】:Caculate point 50 miles away (North, 45% NE, 45% SW)计算 50 英里外的点(北,45% NE,45% SW)
【发布时间】:2020-05-07 18:16:42
【问题描述】:

在 PostGIS 中,有没有办法计算 50 英里外不同方向的另一个点?

给定一个点,('New York',-74.00,40.71),我如何计算以下点?

1) 50 miles directly North
2) 50 miles 45% North East
4) 50 miles directly East
3) 50 miles 45% South West

更新: 看来http://postgis.net/docs/ST_Project.html 可能是解决方案。

ST_Project('POINT(-74.00 40.71)'::geography, 80467.2, radians(45.0))

但是,我需要参考数据库记录来执行此操作。不要硬编码。

【问题讨论】:

  • 我想对一个有趣的问题投赞成票,对没有表现出努力投反对票。 ±0
  • @Madness-ThisisSE,已更新。

标签: sql postgresql postgis qgis


【解决方案1】:

尝试将ST_ProjectCTE 结合使用 - 将radians 的值调整到您需要的方位角。

WITH j AS (
  SELECT poi::geography AS poi FROM t
)
SELECT 
  ST_AsText(ST_Project(j.poi, 80467.2, radians(90.0)),2),
  ST_AsText(ST_Project(j.poi, 80467.2, radians(45.0)),2),
  ST_AsText(ST_Project(j.poi, 80467.2, radians(180.0)),2),
  ST_AsText(ST_Project(j.poi, 80467.2, radians(135.0)),2),
  ST_AsText(ST_Project(j.poi, 80467.2, radians(270.0)),2),
  ST_AsText(ST_Project(j.poi, 80467.2, radians(225.0)),2),
  ST_AsText(ST_Project(j.poi, 80467.2, radians(360.0)),2),
  ST_AsText(ST_Project(j.poi, 80467.2, radians(315.0)),2)
FROM j;

      st_astext      |      st_astext      |    st_astext     |     st_astext      |      st_astext      |     st_astext      |    st_astext     |      st_astext      
---------------------+---------------------+------------------+--------------------+---------------------+--------------------+------------------+---------------------
 POINT(-73.05 40.71) | POINT(-73.32 41.22) | POINT(-74 39.99) | POINT(-73.33 40.2) | POINT(-74.95 40.71) | POINT(-74.67 40.2) | POINT(-74 41.43) | POINT(-74.68 41.22)
(1 Zeile)

注意:图片中的缓冲区(圆圈)仅用于说明。

【讨论】:

猜你喜欢
  • 2013-03-08
  • 2017-07-17
  • 1970-01-01
  • 1970-01-01
  • 2023-03-23
  • 1970-01-01
  • 2012-03-16
  • 2012-02-18
  • 2020-05-26
相关资源
最近更新 更多