Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/festelo/h3_dart
The package provides Dart version of the H3 Core library, a hexagon-based geographic grid system
https://github.com/festelo/h3_dart
android dart flutter h3 ios linux macos web windows
Last synced: about 2 hours ago
JSON representation
The package provides Dart version of the H3 Core library, a hexagon-based geographic grid system
- Host: GitHub
- URL: https://github.com/festelo/h3_dart
- Owner: festelo
- License: apache-2.0
- Created: 2022-01-24T14:43:42.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-07-10T19:17:42.000Z (about 1 year ago)
- Last Synced: 2024-09-19T08:43:25.683Z (5 days ago)
- Topics: android, dart, flutter, h3, ios, linux, macos, web, windows
- Language: C
- Homepage: https://pub.dev/packages/h3_flutter
- Size: 519 KB
- Stars: 18
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## H3 Flutter
The package allows to use Uber's [H3 library](https://github.com/uber/h3) directly in your Dart application
The package uses [h3_ffi](https://pub.dev/packages/h3_ffi) and [h3_web](https://pub.dev/packages/h3_web) under the hood.
```dart
final h3Factory = const H3Factory();
final h3 = h3Factory.load();
// Get hexagons in specified triangle.
final hexagons = h3.polyfill(
resolution: 5,
coordinates: [
GeoCoord(20.4522, 54.7104),
GeoCoord(37.6173, 55.7558),
GeoCoord(39.7015, 47.2357),
],
);
```There are also few methods ported from JS library [Geojson2H3](https://github.com/uber/geojson2h3), to access them you should instantiate Geojson2H3 class using `const Geojson2H3(h3)`. It uses [package:geojson2h3](https://pub.dev/packages/geojson2h3) internally.
## Setup
### Mobile, DesktopAdd `h3_flutter` package to `pubspec.yaml`, import it and load, no further actions required.
```dart
import 'package:h3_flutter/h3_flutter.dart';final h3 = const H3Factory().load();
final geojson2h3 = Geojson2H3(h3);
```### Web
Web version is built on top of `h3-js` v3.7.2, you have to import it.
Add next line to your `index.html`:
```html
```
*Note, `main.dart.js` import should go after this line*