8 个版本
0.3.0 | 2022 年 5 月 8 日 |
---|---|
0.2.5 | 2021 年 4 月 16 日 |
0.2.4 | 2020 年 11 月 24 日 |
0.2.3 | 2020 年 3 月 4 日 |
0.1.0 | 2018 年 4 月 25 日 |
在 地理空间 分类中排名 139
每月下载量 32 次
9.5MB
148 行(不包括注释)
rgeo
Rust 库,用于反向地理编码。使用 geonames 数据库中的数据。http://www.geonames.org/ (http://download.geonames.org/export/dump/allCountries.zip)
使用方法
extern crate rgeo;
use rgeo::{search, nearest};
search(44.353339_f32, -72.740231_f32);
// Some((0.0001186200820000013, Record { name: "Village of Waterbury", latitude: 44.34279, longitude: -72.74294, country: "US" }))
nearest(44.353_339_f32, -72.740_231_f32, 6);
// Some([(0.00011866877, Record { name: "Village of Waterbury", latitude: 44.34279, longitude: -72.74294, country: "US" }), (0.00049654034, Record { name: "Waterbury", latitude: 44.33783, longitude: -72.75623, country: "US" }), (0.0010441553, Record { name: "Town of Waterbury", latitude: 44.38513, longitude: -72.74602, country: "US" }), (0.009455653, Record { name: "Town of Duxbury", latitude: 44.30492, longitude: -72.82456, country: "US" }), (0.0100118, Record { name: "Town of Moretown", latitude: 44.25658, longitude: -72.71475, country: "US" }), (0.010925336, Record { name: "Moretown", latitude: 44.25089, longitude: -72.76095, country: "US" })])
离线数据默认设置下约占用 19M。不含人口少于 100 的人口位置。
基准测试
使用 kdtree
search time: [1.2217 us 1.2234 us 1.2254 us]
Found 16 outliers among 100 measurements (16.00%)
3 (3.00%) high mild
13 (13.00%) high severe
使用 kiddo
search time: [726.85 ns 730.24 ns 736.53 ns]
change: [-40.476% -40.291% -40.076%] (p = 0.00 < 0.05)
Performance has improved.
使用 kiddo 和 nearest_one
search time: [490.32 ns 492.09 ns 494.60 ns]
change: [-32.854% -32.427% -31.970%] (p = 0.00 < 0.05)
Performance has improved.
依赖项
~2.7–3.5MB
~65K SLoC