geohex 3.2.0+5

Dart native js
Flutter Android iOS web

Dart implementation of Hexagonal geo-coding system (GeoHex.org) encoding.

example/geohex_example.dart

import 'dart:math' as math;

import 'package:geohex/geohex.dart';

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

  final a = GeoHex.decode('XM488507762');
  final b = GeoHex.decode('XM488531402');

  final len = math.sqrt(math.pow(b.x - a.x, 2) + math.pow(b.y - a.y, 2));

  print('${len * a.hexSize} 鯨尺');
  print('${(len * a.hexSize) / (25 / 66)}m');
  print('${(len * a.hexSize) / (10 / 33)}m');
}
0
likes
85
pub points
0%
popularity

Publisher

dart.tools

Dart implementation of Hexagonal geo-coding system (GeoHex.org) encoding.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on geohex