geohex 3.2.0+3

GeoHex for Dart #

pub package Coverage Status Build Status

Implementation of GeoHex encoding for Dart language.

Usage #

Encoding example:

import 'package:geohex/geohex.dart';

main() {
  //Location of Capetown
  String geoHexCode = GeoHex.encode(-33.91522085, 18.3758784, 4); //OM4138
}

Decoding example:

import 'package:geohex/geohex.dart';

main() {
  //Geocode of Capetown
  Zone 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 lib 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, eight points after dot the should be enough for everything.

3.2.0+1 #

  • Initial version.
  • Precision clamping

3.2.0+2 #

  • Added some tests

3.2.0+3 #

  • Added missing export of zone.dart, thanx synw

example/geohex_example.dart

import 'package:geohex/geohex.dart';

void main() {
  final geoHexCode = GeoHex.encode(-33.91522085, 18.3758784, 4); //Capetown
  print('http://geohex.net/$geoHexCode');
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  geohex: ^3.2.0+3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:geohex/geohex.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:geohex/geohex.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
Dev dependencies
pedantic ^1.8.0+1
test ^1.6.5