【问题标题】:MySQL Great Circle intersection (do two roads cross?)MySQL Great Circle 交叉口(两条路交叉吗?)
【发布时间】:2011-01-05 13:18:18
【问题描述】:

MySQL OpenGIS CROSSES 似乎不适合我:

SET @ls = 'LineString(1 1, 2 2, 3 3)';
SET @xx = 'LineString(0 2, 10 2)';

# SELECT AsText(EndPoint(GeomFromText(@ls)));
select crosses(GeomFromText(@ls), GeomFromText(@xx))

返回 0 - 预期为 1

如何将其重写为 MySQL 函数?

使用纬度、经度和球面投影(可能还有大圆)的奖励积分。

PS 我无法创建标签,并且丢失了旧登录名:有用的标签是:MySQL OpenGIS CROSSES greatcircle lat lon - :)

【问题讨论】:

    标签: mysql great-circle opengis


    【解决方案1】:

    只需使用 INTERSECTS(line1,line2)

    SET @ls = 'LineString(1 0,1 2)';
    SET @xx = 'LineString(0 1, 2 1)';
    select INTERSECTS(GeomFromText(@ls), GeomFromText(@xx));
    

    【讨论】:

    • 我不敢相信我错过了这个功能 :( 呃!我将把我的问题留给未回答的问题,因为我想看看是否有人有一个适用于球体的 INTERSECTS。
    • SET @aa = 'LineString(0 3, 5 10)'; SET @bb = 'LineString(0 0, 10 10)';选择 INTERSECTS(GeomFromText(@aa), GeomFromText(@bb)) AS i;返回 1 - 这些线不相交?还是我太厚了?
    • 好的,INTERSECTS 有缺陷:stackoverflow.com/questions/4610762/…
    【解决方案2】:

    好的,最后我只是实现了这个:http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/

    【讨论】:

      猜你喜欢
      • 2015-03-15
      • 1970-01-01
      • 1970-01-01
      • 2012-07-23
      • 2017-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多