0

中心点と一連の点が与えられた場合、どの点が原点から最も遠く、互いに最小の距離にあるかを確認できる宝石/関数はありますか?

def find_furthest origin, set, min_distance 
    #
end

距離の計算方法、代替案を歓迎します

http://www.esawdust.com/blog/gps/files/HaversineFormulaInRuby.html

{"lat"=>43.643326, "lng"=>-79.3831843}

セットする

    [{"lat"=>43.64506, "lng"=>-79.384136},
     {"lat"=>43.642806, "lng"=>-79.380683},
     {"lat"=>43.645062, "lng"=>-79.384126},
     {"lat"=>43.644701, "lng"=>-79.384699},
     {"lat"=>43.644987, "lng"=>-79.383204},
     {"lat"=>43.64506, "lng"=>-79.384136},
     {"lat"=>43.644537, "lng"=>-79.385584},
     {"lat"=>43.643393, "lng"=>-79.380678},
     {"lat"=>43.642736, "lng"=>-79.381281},
     {"lat"=>43.642487, "lng"=>-79.382914},
     {"lat"=>43.642426, "lng"=>-79.383248},
     {"lat"=>43.642415, "lng"=>-79.383254},
     {"lat"=>43.645099, "lng"=>-79.383252},
     {"lat"=>43.642425, "lng"=>-79.383374},
     {"lat"=>43.64482, "lng"=>-79.385219},
     {"lat"=>43.64482, "lng"=>-79.385219},
     {"lat"=>43.645082, "lng"=>-79.38379},
     {"lat"=>43.64333, "lng"=>-79.380654},
     {"lat"=>43.644535, "lng"=>-79.385171},
     {"lat"=>43.64482, "lng"=>-79.385219}]
4

1 に答える 1

0

このような宝石をお探しですか?https://rubygems.org/gems/geo-distance

于 2013-02-21T19:07:31.537 に答える