Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikotron/geohex
Dart implementation of GeoHex encoding
https://github.com/nikotron/geohex
dart flutter geocoder geocoding geocoding-library geohex geospatial pubspec
Last synced: 2 months ago
JSON representation
Dart implementation of GeoHex encoding
- Host: GitHub
- URL: https://github.com/nikotron/geohex
- Owner: NiKoTron
- License: mit
- Created: 2019-08-11T13:29:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-27T21:51:07.000Z (almost 3 years ago)
- Last Synced: 2024-11-15T06:33:28.684Z (2 months ago)
- Topics: dart, flutter, geocoder, geocoding, geocoding-library, geohex, geospatial, pubspec
- Language: Dart
- Homepage: https://pub.dev/packages/geohex
- Size: 116 KB
- Stars: 3
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# GeoHex for Dart
[![pub package](https://img.shields.io/pub/v/geohex.svg)](https://pub.dartlang.org/packages/geohex) [![Coverage Status](https://coveralls.io/repos/github/NiKoTron/geohex/badge.svg?branch=master)](https://coveralls.io/github/NiKoTron/geohex?branch=master) [![Build Status](https://travis-ci.org/NiKoTron/geohex.svg?branch=master)](https://travis-ci.org/NiKoTron/geohex)
Implementation of `geohex.org` encoding for Dart language.
## Usage
Encoding example:
```dart
import 'package:geohex/geohex.dart';main() {
//Location of Capetown
final geoHexCode = GeoHex.encode(-33.91522085, 18.3758784, 4); //OM4138
}```
Decoding example:
```dart
import 'package:geohex/geohex.dart';main() {
//Geocode of Capetown
final geoHexZone = GeoHex.decode('OM4138'); // instance of Zone with lat -33.91522085 lon 18.3758784 and level 4
}```
## Note
This realisation has some difference with the original lib. It's location clamping. Original `geohex.org` uses `double` representation of lat'n'lon, so theoretically, it should take more precision etc. but in fact, it leads to errors.
Refer to this - [decimal degrees](https://en.wikipedia.org/wiki/Decimal_degrees), eight points after dot the should be enough for everything.