proximity_hash
所属分类:其他
开发工具:Dart
文件大小:0KB
下载次数:0
上传日期:2023-12-01 21:36:27
上 传 者:
sh-1993
说明: 给定中心坐标和半径,Proximity Hash生成一组覆盖圆形区域的地理哈希。
(Proximity Hash generates a set of geohashes that cover a circular area, given the center coordinates and the radius.)
文件列表:
.metadata (309, 2023-12-01)
CHANGELOG.md (316, 2023-12-01)
LICENSE (11357, 2023-12-01)
example/ (0, 2023-12-01)
example/main.dart (931, 2023-12-01)
lib/ (0, 2023-12-01)
lib/geohash.dart (10850, 2023-12-01)
lib/proximity_hash.dart (4314, 2023-12-01)
pubspec.yaml (284, 2023-12-01)
test/ (0, 2023-12-01)
test/geohash_test.dart (2214, 2023-12-01)
test/proximity_hash_test.dart (1605, 2023-12-01)
# Dart Proximity Hash
![Pub Version](https://img.shields.io/pub/v/proximity_hash)
**Proximity Hash** generates a set of geohashes that cover a circular area, given the center coordinates and the radius. Geohash is a public domain geocode system which encodes a geographic location into a short string of letters and digits and is used as unique identifies and to represent point data in databases.
For example the point
`25.6953° S, 54.4367° W`
will covert to
`6g3mc626`.
## Geohash
Proximity hash also comes with a geohash library forked from [dart_geohash](https://github.com/nfrawley93/dart_geohash/pull/5) since it was not being actively maintained.
```dart
import 'package:proximity_hash/geohash.dart';
```
## Install
To get this plugin, add `proximity_hash` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). For example:
```yaml
dependencies:
proximity_hash: ^1.1.0
```
## Usage
To get all the geohashes within a radius of `5000` meters from the point `25.6953° S, 54.4367° W` with precision `3` simply import the library and call `createGeohashes()`. The precision dictates how long and how many geohashes are returned. For
example a precision of 3 returns geohahses of length 3.
``` dart
import 'package:proximity_hash/proximity_hash.dart';
List
proximityGeohashes = createGeohashes(48.864716, 2.349014, 5000, 3);
// proximityGeohashes == ["u0d","u09"]
```
## Performance
Benchmark of `createGeohashes` for different precisions with radius `1000`. Performance can become limiting starting at precision 9. Note that a larger radius will also decrease performance.
| Precicion | Time |
| ----------- | ----------- |
| 1 | .0068 sec |
| 2 | .0068 sec |
| 3 | .0070 sec |
| 4 | .0070 sec |
| 5 | .0070 sec |
| 6 | .0079 sec |
| 7 | .0232 sec |
| 8 | .1664 sec |
| 9 | 4.996 sec |
| 10 | 153.5 sec |
## Issues
Please file any issues, bugs or feature requests as an issue on our [GitHub](https://github.com/anovis/proximity_hash/issues) page.
## Want to Contribute
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature) submit a [pull request](https://github.com/anovis/proximity_hash/pulls).
## Want to Support
___
Based on [proximityhash](https://github.com/ashwin711/proximityhash)
近期下载者:
相关文件:
收藏者: