polyfill abstract method

List<BigInt> polyfill({
  1. required List<GeoCoord> coordinates,
  2. required int resolution,
  3. List<List<GeoCoord>> holes,
})

Takes a given coordinates and resolution and returns hexagons that are contained by them.

resolution must be in the range 0, 15.

This implementation traces the GeoJSON geofence(s) in cartesian space with hexagons, tests them and their neighbors to be contained by the geofence(s), and then any newly found hexagons are used to test again until no new hexagons are found.

final hexagons = h3.polyfill(
  coordinates: const [
    GeoCoord(lat: 37.813318999983238, lon: -122.4089866999972145),
    GeoCoord(lat: 37.7866302000007224, lon: -122.3805436999997056),
    GeoCoord(lat: 37.7198061999978478, lon: -122.3544736999993603),
    GeoCoord(lat: 37.7076131999975672, lon: -122.5123436999983966),
    GeoCoord(lat: 37.7835871999971715, lon: -122.5247187000021967),
    GeoCoord(lat: 37.8151571999998453, lon: -122.4798767000009008),
  ],
  resolution: 9,
)

Implementation

List<BigInt> polyfill({
  required List<GeoCoord> coordinates,
  required int resolution,
  List<List<GeoCoord>> holes,
});