【问题标题】:What is the equivalent of GeoPy for Scala or Java?Scala 或 Java 的 GeoPy 等价物是什么?
【发布时间】:2015-08-11 13:13:21
【问题描述】:

GeoPy 是另一个实现的包装器吗?我在哪里可以找到等效的 Scala 或 Java 解决方案来测量两个坐标之间的距离? Geotools 不能按我想要的方式工作。例如,我发现了一些坐标不收敛并返回错误的情况。

【问题讨论】:

标签: scala geolocation geopy


【解决方案1】:

GeographicLib-Java 包(我写了这个)会做你想做的事。 它在椭球上进行各种测地线计算。解决方案 因为两点之间的距离总是会收敛的。

【讨论】:

    【解决方案2】:

    还可以查看Geocalc。我是为我的一个网站写的

    //Kew, London
    Coordinate lat = new DegreeCoordinate(51.4843774);
    Coordinate lng = new DegreeCoordinate(-0.2912044);
    Point kew = new Point(lat, lng);
    
    //Richmond, London
    lat = new DegreeCoordinate(51.4613418);
    lng = new DegreeCoordinate(-0.3035466);
    Point richmond = new Point(lat, lng);
    
    double distance = EarthCalc.getDistance(richmond, kew); //in meters
    double distance = EarthCalc.getHarvesineDistance(richmond, kew); //in meters
    double distance = EarthCalc.getVincentyDistance(richmond, kew); //in meters
    

    【讨论】:

      【解决方案3】:

      过去我曾使用过JTS,它是一个非常丰富的库,用于处理地理参考数据。如果你想在 Scala 中使用它,它不是很地道,但我知道 there's a binding library 可能适合你的需求。

      【讨论】:

        猜你喜欢
        • 2010-11-13
        • 2011-12-10
        • 2014-03-15
        • 2012-11-25
        • 2014-03-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-11-10
        相关资源
        最近更新 更多