h3-js provides a JavaScript version of H3, a hexagon-based geospatial indexing system.

Overview

H3 Logo

h3-js

Build Status Coverage Status License npm version H3 Version

The h3-js library provides a pure-JavaScript version of the H3 Core Library, a hexagon-based geographic grid system. It can be used either in Node >= 6 or in the browser. The core library is transpiled from C using emscripten, offering full parity with the C API and highly efficient operations.

For more information on H3 and for the full API documentation, please see the H3 Documentation.

Install

npm install h3-js

Usage

The library uses ES6 modules. Bundles for Node and the browser are built to the dist folder.

Import

ES6 usage:

import {h3ToGeo} from "h3-js";

CommonJS usage:

const h3 = require("h3-js");

Pre-bundled script (library is available as an h3 global):

">
<script src="https://unpkg.com/h3-js">script>

Core functions

// Convert a lat/lng point to a hexagon index at resolution 7
const h3Index = h3.geoToH3(37.3615593, -122.0553238, 7);
// -> '87283472bffffff'

// Get the center of the hexagon
const hexCenterCoordinates = h3.h3ToGeo(h3Index);
// -> [37.35171820183272, -122.05032565263946]

// Get the vertices of the hexagon
const hexBoundary = h3.h3ToGeoBoundary(h3Index);
// -> [ [37.341099093235684, -122.04156135164334 ], ...]

Useful algorithms

// Get all neighbors within 1 step of the hexagon
const kRing = h3.kRing(h3Index, 1);
// -> ['87283472bffffff', '87283472affffff', ...]

// Get the set of hexagons within a polygon
const polygon = [
    [37.813318999983238, -122.4089866999972145],
    [37.7198061999978478, -122.3544736999993603],
    [37.8151571999998453, -122.4798767000009008]
];
const hexagons = h3.polyfill(polygon, 7);
// -> ['872830828ffffff', '87283082effffff', ...]

// Get the outline of a set of hexagons, as a GeoJSON-style MultiPolygon
const coordinates = h3.h3SetToMultiPolygon(hexagons, true);
// -> [[[
//      [-122.37681938644465, 37.76546768434345],
//      [-122.3856345540363,37.776004200673846],
//      ...
//    ]]]

API Reference

h3


h3.h3IsValid(h3Index) ⇒ boolean

Whether a given string represents a valid H3 index

Returns: boolean - Whether the index is valid

Param Type Description
h3Index H3IndexInput H3 index to check

h3.h3IsPentagon(h3Index) ⇒ boolean

Whether the given H3 index is a pentagon

Returns: boolean - isPentagon

Param Type Description
h3Index H3IndexInput H3 index to check

h3.h3IsResClassIII(h3Index) ⇒ boolean

Whether the given H3 index is in a Class III resolution (rotated versus the icosahedron and subject to shape distortion adding extra points on icosahedron edges, making them not true hexagons).

Returns: boolean - isResClassIII

Param Type Description
h3Index H3IndexInput H3 index to check

h3.h3GetBaseCell(h3Index) ⇒ number

Get the number of the base cell for a given H3 index

Returns: number - Index of the base cell (0-121)

Param Type Description
h3Index H3IndexInput H3 index to get the base cell for

h3.h3GetFaces(h3Index) ⇒ Array.

Get the indices of all icosahedron faces intersected by a given H3 index

Returns: Array. - Indices (0-19) of all intersected faces

Param Type Description
h3Index H3IndexInput H3 index to get faces for

h3.h3GetResolution(h3Index) ⇒ number

Returns the resolution of an H3 index

Returns: number - The number (0-15) resolution, or -1 if invalid

Param Type Description
h3Index H3IndexInput H3 index to get resolution

h3.geoToH3(lat, lng, res) ⇒ H3Index

Get the hexagon containing a lat,lon point

Returns: H3Index - H3 index

Param Type Description
lat number Latitude of point
lng number Longtitude of point
res number Resolution of hexagons to return

h3.h3ToGeo(h3Index) ⇒ Array.

Get the lat,lon center of a given hexagon

Returns: Array. - Point as a [lat, lng] pair

Param Type Description
h3Index H3IndexInput H3 index

h3.h3ToGeoBoundary(h3Index, [formatAsGeoJson]) ⇒ Array. >

Get the vertices of a given hexagon (or pentagon), as an array of [lat, lng] points. For pentagons and hexagons on the edge of an icosahedron face, this function may return up to 10 vertices.

Returns: Array. > - Array of [lat, lng] pairs

Param Type Description
h3Index H3Index H3 index
[formatAsGeoJson] boolean Whether to provide GeoJSON output: [lng, lat], closed loops

h3.h3ToParent(h3Index, res) ⇒ H3Index

Get the parent of the given hexagon at a particular resolution

Returns: H3Index - H3 index of parent, or null for invalid input

Param Type Description
h3Index H3IndexInput H3 index to get parent for
res number Resolution of hexagon to return

h3.h3ToChildren(h3Index, res) ⇒ Array.

Get the children/descendents of the given hexagon at a particular resolution

Returns: Array. - H3 indexes of children, or empty array for invalid input

Param Type Description
h3Index H3IndexInput H3 index to get children for
res number Resolution of hexagons to return

h3.h3ToCenterChild(h3Index, res) ⇒ H3Index

Get the center child of the given hexagon at a particular resolution

Returns: H3Index - H3 index of child, or null for invalid input

Param Type Description
h3Index H3IndexInput H3 index to get center child for
res number Resolution of hexagon to return

h3.kRing(h3Index, ringSize) ⇒ Array.

Get all hexagons in a k-ring around a given center. The order of the hexagons is undefined.

Returns: Array. - H3 indexes for all hexagons in ring

Param Type Description
h3Index H3IndexInput H3 index of center hexagon
ringSize number Radius of k-ring

h3.kRingDistances(h3Index, ringSize) ⇒ Array. >

Get all hexagons in a k-ring around a given center, in an array of arrays ordered by distance from the origin. The order of the hexagons within each ring is undefined.

Returns: Array. > - Array of arrays with H3 indexes for all hexagons each ring

Param Type Description
h3Index H3IndexInput H3 index of center hexagon
ringSize number Radius of k-ring

h3.hexRing(h3Index, ringSize) ⇒ Array.

Get all hexagons in a hollow hexagonal ring centered at origin with sides of a given length. Unlike kRing, this function will throw an error if there is a pentagon anywhere in the ring.

Returns: Array. - H3 indexes for all hexagons in ring
Throws:

  • Error If the algorithm could not calculate the ring
Param Type Description
h3Index H3IndexInput H3 index of center hexagon
ringSize number Radius of ring

h3.polyfill(coordinates, res, [isGeoJson]) ⇒ Array.

Get all hexagons with centers contained in a given polygon. The polygon is specified with GeoJson semantics as an array of loops. Each loop is an array of [lat, lng] pairs (or [lng, lat] if isGeoJson is specified). The first loop is the perimeter of the polygon, and subsequent loops are expected to be holes.

Returns: Array. - H3 indexes for all hexagons in polygon

Param Type Description
coordinates Array. > | Array. >> Array of loops, or a single loop
res number Resolution of hexagons to return
[isGeoJson] boolean Whether to expect GeoJson-style [lng, lat] pairs instead of [lat, lng]

h3.h3SetToMultiPolygon(h3Indexes, [formatAsGeoJson]) ⇒ Array. >>>

Get the outlines of a set of H3 hexagons, returned in GeoJSON MultiPolygon format (an array of polygons, each with an array of loops, each an array of coordinates). Coordinates are returned as [lat, lng] pairs unless GeoJSON is requested.

It is the responsibility of the caller to ensure that all hexagons in the set have the same resolution and that the set contains no duplicates. Behavior is undefined if duplicates or multiple resolutions are present, and the algorithm may produce unexpected or invalid polygons.

Returns: Array. >>> - MultiPolygon-style output.

Param Type Description
h3Indexes Array. H3 indexes to get outlines for
[formatAsGeoJson] boolean Whether to provide GeoJSON output: [lng, lat], closed loops

h3.compact(h3Set) ⇒ Array.

Compact a set of hexagons of the same resolution into a set of hexagons across multiple levels that represents the same area.

Returns: Array. - Compacted H3 indexes
Throws:

  • Error If the input is invalid (e.g. duplicate hexagons)
Param Type Description
h3Set Array. H3 indexes to compact

h3.uncompact(compactedSet, res) ⇒ Array.

Uncompact a compacted set of hexagons to hexagons of the same resolution

Returns: Array. - The uncompacted H3 indexes
Throws:

  • Error If the input is invalid (e.g. invalid resolution)
Param Type Description
compactedSet Array. H3 indexes to uncompact
res number The resolution to uncompact to

h3.h3IndexesAreNeighbors(origin, destination) ⇒ boolean

Whether two H3 indexes are neighbors (share an edge)

Returns: boolean - Whether the hexagons share an edge

Param Type Description
origin H3IndexInput Origin hexagon index
destination H3IndexInput Destination hexagon index

h3.getH3UnidirectionalEdge(origin, destination) ⇒ H3Index

Get an H3 index representing a unidirectional edge for a given origin and destination

Returns: H3Index - H3 index of the edge, or null if no edge is shared

Param Type Description
origin H3IndexInput Origin hexagon index
destination H3IndexInput Destination hexagon index

h3.getOriginH3IndexFromUnidirectionalEdge(edgeIndex) ⇒ H3Index

Get the origin hexagon from an H3 index representing a unidirectional edge

Returns: H3Index - H3 index of the edge origin

Param Type Description
edgeIndex H3IndexInput H3 index of the edge

h3.getDestinationH3IndexFromUnidirectionalEdge(edgeIndex) ⇒ H3Index

Get the destination hexagon from an H3 index representing a unidirectional edge

Returns: H3Index - H3 index of the edge destination

Param Type Description
edgeIndex H3IndexInput H3 index of the edge

h3.h3UnidirectionalEdgeIsValid(edgeIndex) ⇒ boolean

Whether the input is a valid unidirectional edge

Returns: boolean - Whether the index is valid

Param Type Description
edgeIndex H3IndexInput H3 index of the edge

h3.getH3IndexesFromUnidirectionalEdge(edgeIndex) ⇒ Array.

Get the [origin, destination] pair represented by a unidirectional edge

Returns: Array. - [origin, destination] pair as H3 indexes

Param Type Description
edgeIndex H3IndexInput H3 index of the edge

h3.getH3UnidirectionalEdgesFromHexagon(h3Index) ⇒ Array.

Get all of the unidirectional edges with the given H3 index as the origin (i.e. an edge to every neighbor)

Returns: Array. - List of unidirectional edges

Param Type Description
h3Index H3IndexInput H3 index of the origin hexagon

h3.getH3UnidirectionalEdgeBoundary(edgeIndex, [formatAsGeoJson]) ⇒ Array. >

Get the vertices of a given edge as an array of [lat, lng] points. Note that for edges that cross the edge of an icosahedron face, this may return 3 coordinates.

Returns: Array. > - Array of geo coordinate pairs

Param Type Description
edgeIndex H3IndexInput H3 index of the edge
[formatAsGeoJson] boolean Whether to provide GeoJSON output: [lng, lat]

h3.h3Distance(origin, destination) ⇒ number

Get the grid distance between two hex indexes. This function may fail to find the distance between two indexes if they are very far apart or on opposite sides of a pentagon.

Returns: number - Distance between hexagons, or a negative number if the distance could not be computed

Param Type Description
origin H3IndexInput Origin hexagon index
destination H3IndexInput Destination hexagon index

h3.h3Line(origin, destination) ⇒ Array.

Given two H3 indexes, return the line of indexes between them (inclusive).

This function may fail to find the line between two indexes, for example if they are very far apart. It may also fail when finding distances for indexes on opposite sides of a pentagon.

Notes:

  • The specific output of this function should not be considered stable across library versions. The only guarantees the library provides are that the line length will be h3Distance(start, end) + 1 and that every index in the line will be a neighbor of the preceding index.
  • Lines are drawn in grid space, and may not correspond exactly to either Cartesian lines or great arcs.

Returns: Array. - H3 indexes connecting origin and destination
Throws:

  • Error If the line cannot be calculated
Param Type Description
origin H3IndexInput Origin hexagon index
destination H3IndexInput Destination hexagon index

h3.experimentalH3ToLocalIj(origin, destination) ⇒ CoordIJ

Produces IJ coordinates for an H3 index anchored by an origin.

  • The coordinate space used by this function may have deleted regions or warping due to pentagonal distortion.
  • Coordinates are only comparable if they come from the same origin index.
  • Failure may occur if the index is too far away from the origin or if the index is on the other side of a pentagon.
  • This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.

Returns: CoordIJ - Coordinates as an {i, j} pair
Throws:

  • Error If the IJ coordinates cannot be calculated
Param Type Description
origin H3IndexInput Origin H3 index
destination H3IndexInput H3 index for which to find relative coordinates

h3.experimentalLocalIjToH3(origin, coords) ⇒ H3Index

Produces an H3 index for IJ coordinates anchored by an origin.

  • The coordinate space used by this function may have deleted regions or warping due to pentagonal distortion.
  • Coordinates are only comparable if they come from the same origin index.
  • Failure may occur if the index is too far away from the origin or if the index is on the other side of a pentagon.
  • This function is experimental, and its output is not guaranteed to be compatible across different versions of H3.

Returns: H3Index - H3 index at the relative coordinates
Throws:

  • Error If the H3 index cannot be calculated
Param Type Description
origin H3IndexInput Origin H3 index
coords CoordIJ Coordinates as an {i, j} pair

h3.pointDist(latlng1, latlng2, unit) ⇒ number

Great circle distance between two geo points. This is not specific to H3, but is implemented in the library and provided here as a convenience.

Returns: number - Great circle distance
Throws:

  • Error If the unit is invalid
Param Type Description
latlng1 Array. Origin coordinate as [lat, lng]
latlng2 Array. Destination coordinate as [lat, lng]
unit string Distance unit (either UNITS.m or UNITS.km)

h3.cellArea(h3Index, unit) ⇒ number

Exact area of a given cell

Returns: number - Cell area
Throws:

  • Error If the unit is invalid
Param Type Description
h3Index H3Index H3 index of the hexagon to measure
unit string Distance unit (either UNITS.m2 or UNITS.km2)

h3.exactEdgeLength(edge, unit) ⇒ number

Exact length of a given unidirectional edge

Returns: number - Cell area
Throws:

  • Error If the unit is invalid
Param Type Description
edge H3Index H3 index of the edge to measure
unit string Distance unit (either UNITS.m, UNITS.km, or UNITS.rads)

h3.hexArea(res, unit) ⇒ number

Average hexagon area at a given resolution

Returns: number - Average area
Throws:

  • Error If the unit is invalid
Param Type Description
res number Hexagon resolution
unit string Area unit (either UNITS.m2, UNITS.km2, or UNITS.rads2)

h3.edgeLength(res, unit) ⇒ number

Average hexagon edge length at a given resolution

Returns: number - Average edge length
Throws:

  • Error If the unit is invalid
Param Type Description
res number Hexagon resolution
unit string Distance unit (either UNITS.m, UNITS.km, or UNITS.rads)

h3.numHexagons(res) ⇒ number

The total count of hexagons in the world at a given resolution. Note that above resolution 8 the exact count cannot be represented in a JavaScript 32-bit number, so consumers should use caution when applying further operations to the output.

Returns: number - Count

Param Type Description
res number Hexagon resolution

h3.getRes0Indexes() ⇒ Array.

Get all H3 indexes at resolution 0. As every index at every resolution > 0 is the descendant of a res 0 index, this can be used with h3ToChildren to iterate over H3 indexes at any resolution.

Returns: Array. - All H3 indexes at res 0


h3.getPentagonIndexes(res) ⇒ Array.

Get the twelve pentagon indexes at a given resolution.

Returns: Array. - All H3 pentagon indexes at res

Param Type Description
res number Hexagon resolution

h3.degsToRads(deg) ⇒ number

Convert degrees to radians

Returns: number - Value in radians

Param Type Description
deg number Value in degrees

h3.radsToDegs(rad) ⇒ number

Convert radians to degrees

Returns: number - Value in degrees

Param Type Description
rad number Value in radians

h3.H3Index : string

64-bit hexidecimal string representation of an H3 index


h3.H3IndexInput : string | Array.

64-bit hexidecimal string representation of an H3 index, or two 32-bit integers in little endian order in an array.


h3.CoordIJ : Object

Coordinates as an {i, j} pair

Properties

Name Type
i number
j number

h3.UNITS : Object

Length/Area units

Properties

Name Type
m string
m2 string
km string
km2 string
rads string
rads2 string

Development

The h3-js library uses yarn as the preferred package manager. To install the dev dependencies, just run:

yarn

To lint the code:

yarn lint

To run the tests:

yarn test

Code must be formatted with prettier; unformatted code will fail the build. To format all files:

yarn prettier

Benchmarks

The h3-js library includes a basic benchmark suite using Benchmark.js. Because many of the functions may be called over thousands of hexagons in a "hot loop", performance is an important concern. Benchmarks are run against the transpiled ES5 code by default.

To run the benchmarks in Node:

yarn benchmark-node

To run the benchmarks in a browser:

yarn benchmark-browser

Sample Node output (Macbook Pro running Node 6):

h3IsValid x 3,725,046 ops/sec ±0.47% (90 runs sampled)
geoToH3 x 227,458 ops/sec ±0.84% (89 runs sampled)
h3ToGeo x 843,167 ops/sec ±0.96% (87 runs sampled)
h3ToGeoBoundary x 220,797 ops/sec ±2.56% (86 runs sampled)
kRing x 144,955 ops/sec ±3.06% (85 runs sampled)
polyfill x 9,291 ops/sec ±1.12% (88 runs sampled)
h3SetToMultiPolygon x 311 ops/sec ±1.56% (82 runs sampled)
compact x 1,336 ops/sec ±4.51% (86 runs sampled)
uncompact x 574 ops/sec ±0.91% (85 runs sampled)
h3IndexesAreNeighbors x 670,031 ops/sec ±1.36% (88 runs sampled)
getH3UnidirectionalEdge x 356,089 ops/sec ±1.17% (85 runs sampled)
getOriginH3IndexFromUnidirectionalEdge x 1,052,652 ops/sec ±0.54% (89 runs sampled)
getDestinationH3IndexFromUnidirectionalEdge x 891,680 ops/sec ±0.90% (91 runs sampled)
h3UnidirectionalEdgeIsValid x 3,551,111 ops/sec ±0.69% (85 runs sampled)

When making code changes that may affect performance, please run benchmarks against master and then against your branch to identify any regressions.

Transpiling the C Source

The core library is transpiled using emscripten. The easiest way to build from source locally is by using Docker. Make sure Docker is installed, then:

yarn docker-boot
yarn build-emscripten

The build script uses the H3_VERSION file to determine the version of the core library to build. To use a different version of the library (e.g. to test local changes), clone the desired H3 repo to ./h3c and then run yarn docker-emscripten.

Contributing

Pull requests and Github issues are welcome. Please include tests for new work, and keep the library test coverage at 100%. Please note that the purpose of this module is to expose the API of the H3 Core library, so we will rarely accept new features that are not part of that API. New proposed feature work is more appropriate in the core C library or in a new JS library that depends on h3-js.

Before we can merge your changes, you must agree to the Uber Contributor License Agreement.

Versioning

The H3 core library adheres to Semantic Versioning. The h3-js library has a major.minor.patch version scheme. The major and minor version numbers of h3-js are the major and minor version of the bound core library, respectively. The patch version is incremented independently of the core library.

Legal and Licensing

The h3-js library is licensed under the Apache 2.0 License.

DGGRID Copyright (c) 2015 Southern Oregon University

Comments
  • can't find variable: document

    can't find variable: document

    I'm trying to us the h3-js library in a react-native app. I npm installed the library, and then when I just import h3 into one of my files, it gives me an error that say's can't find variable document. I'm assuming it is coming from the libh3.js file in "./dist/out" where it has the function....

    var libh3 = (function() { var _scriptDir = typeof document !== 'undefined' && dtocument.currentScript ? document.currentScript.src : undefined; return ( ........

    I don't know where the problem is coming from but it's not in my code because I'm just trying to import h3-js

    opened by nsendek 16
  • Integer value of h3Index

    Integer value of h3Index

    Hi, I know that since Js does not support BigInteger this library is returning hex results as index, but is there any safe way to use BigInt object in js to handle these numbers? since in my case I need to manipulate the indexes.

    opened by am2222 13
  • Questions & Clarification on Coordinate Systems

    Questions & Clarification on Coordinate Systems

    A few questions & clarifications:

    Unfortunately I do not have a background in mathematics, please be patient with me.


    The gist of my use case is a geo-location based mobile game that uses a hexagonal grid to represent the world, something H3 appears to exactly solve for. Though, this use case necessitates the need to have a coordinate system that can uniquely identify each cell in the global grid for a variety of reasons. I am having a hard time figuring out how to obtain coordinates from the cells of an H3 grid.

    H3 Coordinate Systems: https://h3geo.org/docs/core-library/coordsystems Hexagonal Coordinate Systems: https://www.redblobgames.com/grids/hexagons/#coordinates

    I marginally familiar three coordinate systems for hexagonal grids:

    • Offset Coordinates
    • Cube Coordinates (3 axes 120 degrees apart)
    • Axial Coordinates (Essentially cube coordinates sans an axis) [What I am aiming for here]

    In the H3 docs, it mentions:

    • IJK Coordinates
      • This is noted as being the 3 coordinate axes spaced 120° apart which seems like a cube coordinate system. However the example picture's coordinates don't seem to line up with the expectation of i+j+k == 0.
      • What is this if not cube coordinates?
      • Are these globally unique?
      • How can this coordinate be obtained for a given H3Index?
    • FaceIJK Coordinates
      • Simply the IJK coordinates, but centered on each face. And I assume constrained to each face. Definitely not what I'm after.
    • Hex2d Coordinates.
      • [x,y] coordinates for the IJK coordinates with the +x axis aligned on i axis. This appears to be what I am looking for.
      • Are these essentially Axial Coordinates?
      • Is there a specific conversion expectation to go from IJK to Hex2d?
      • How can this coordinate be obtained for a given H3Index?
    • Local IJ Coordinates.
      • At first this looked promising, until I read local coordinates are only valid near the origin.. Which points out that these coordinates are really only valid within the same base cell.

    TL;DR: How can I obtain cartesian coordinates for each cell that are globally unique?

    opened by douglasg14b 9
  • UnhandledRejection

    UnhandledRejection

    The package is listening all 'UnhandledRejection' errors and throwing it's own (h3-js) error from 'dist/hs-js.js', line: 10979 even if the source of the error is not h3-js package itself.

    Is there a way to overwrite this 'UnhandledRejection' errors, what do you suggest?

    opened by erkbamyaci 9
  • Misaligned polygons, not perfect hexagons. Some pentagons. Catering for projection

    Misaligned polygons, not perfect hexagons. Some pentagons. Catering for projection

    Hi,

    Im trying to incorprate your library on a number of solutions which require realtime translations between hex ids and geojson multi/polygons.

    h3.h3SetToMultiPolygon(["85291a6ffffffff"],true)
    

    returns

    [[[[-121.87310260648961,36.48355301296484],[-121.82059177712684,36.56646154014561],[-121.88144909358076,36.64149027277887],[-121.99481876336013,36.63355254199253],[-122.0471691328904,36.550641568925464],[-121.98631059624982,36.4756707384872],[-121.87310260648961,36.48355301296484]]]]
    

    No problem with that. The issue however is displaying this now results in an askew/misrepresented polygon on a map.

    image

    The map is in EPSG:4326. Geojson.io

    {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "properties": {
            "color": "blue"
          },
          "geometry": {
            "type": "MultiPolygon",
            "coordinates": [
              [
                [
                  [
                    -121.87310260648961,
                    36.48355301296484
                  ],
                  [
                    -121.82059177712684,
                    36.56646154014561
                  ],
                  [
                    -121.88144909358076,
                    36.64149027277887
                  ],
                  [
                    -121.99481876336013,
                    36.63355254199253
                  ],
                  [
                    -122.0471691328904,
                    36.550641568925464
                  ],
                  [
                    -121.98631059624982,
                    36.4756707384872
                  ],
                  [
                    -121.87310260648961,
                    36.48355301296484
                  ]
                ]
              ]
            ]
          }
        }
      ]
    }
    

    Is this correct?

    opened by Portur 9
  • Growing memory usage

    Growing memory usage

    Hi,

    I'm using h3-js to compile isochrones (a few hundred millions), and I notices that the memory usage keep growing. After some quick investigations on my code to make sure the issue is not on my side, I think this comes from either h3SetToMultiPolygon or multiPolyfill (I investigate a while ago, and I can't remember). Anyway, after it does what it is supposed to do, a small amont of memory keep being used, and thus, after running it a couple of thousand times, node runs out of memory. For now, as a quick dirty fix, I run it on child processes that I can restart once in a while.

    Sorry for not providing more intels, I investigate this a while ago and found a quick workaround, but it still worth sharing the issue.

    Note: i'm using 3.7.1

    EDIT: version 3.7.1 was apparently supposed to fix this issue. I guess it's still there...

    opened by johanschram 7
  • Feature typescript typegen

    Feature typescript typegen

    I needed typescript definitions for these bindings and noticed you generate your README off of jsdoc.

    I've managed to generate the definitions using tsd-jsdoc requiring minimal change to h3core.js.

    This PR adds the required jsdoc changes, but also a script to bundle the types on prepublish.

    I'm not sure how you feel about distributing these definitions yourself. If you'd rather not, I'll simply remove that part. But I do hope you'll allow the jsdoc changes. :smiley:

    opened by zachasme 7
  • [Question] How to efficiently query using H3

    [Question] How to efficiently query using H3

    Hi!

    I'm creating an app which shows nearby posts in a customizeable radius (with accuracy of ~100m). I've found h3 to be a very efficient library, but I couldn't quite figure out how to efficiently query my firestore NoSQL database using H3, since firestore is very limited in querying capabilities.

    I've currently come up with this solution:

    export async function loadNearbyPosts(coordinates: Coordinates, radius: number): Promise<Post[]> {
      const h3 = geoToH3(coordinates.latitude, coordinates.longitude, H3_RESOLUTION);
      console.log(`${JSON.stringify(coordinates)} -> ${h3}`);
      const neighbours = kRing(h3, 10); // <-- how do I convert my 'radius' in metres to the k-ring range ('10')?
      console.log(`Neighbours of ${h3} include: ${JSON.stringify(neighbours)}`);
    
      const batchedNeighbours: string[][] = [];
      for (let i = 0; i < neighbours.length; i += 10) batchedNeighbours.push(neighbours.splice(i, 10));
    
      console.log(`Batched to size of 10s: ${JSON.stringify(batchedNeighbours)}`);
      console.log(`Running ${batchedNeighbours.length} queries...`);
    
      const start = global.nativePerformanceNow();
      // how do I remove this batching and instead use range checks? something like `greater than this h3 and smaller than this h3`
      const queries = batchedNeighbours.map((n) => firestore().collection('posts').where('location.h3', 'in', n).get());
      const results = await Promise.all(queries);
      const end = global.nativePerformanceNow();
    
      const docs: Post[] = [];
      results.forEach((r) => docs.push(...r.docs.map((d) => build<Post>(d))));
    
      console.log(`Executed ${batchedNeighbours.length} queries and received ${docs.length} results, all within ${end - start}ms.`);
      return docs;
    }
    

    While this does indeed return results for me, it is very inefficient. For this simple query, it actually executes 17 queries (!!) because firestore has a limit of maximum 10 items in an array in the in query (that's why I'm batching the neighbours into arrays of 10 elements), and I'm comparing for exact matches, so I'm forced to using the same precision for all my h3 hexagons.

    Using geohashes, I can find by range since they're alphabetically sorted. E.g. I can filter for bc -> bc~ which gives me all squares that start with bc.

    Now let's get to my actual questions:

    1. Is it possible to "find by range" using h3, similar to geohashes? That way I can remove the batching code and don't have to run 17 queries for a simple "nearby" lookup. I couldn't really find a good explanation of the h3 algorithm on how the tiles are sorted, but if I could reduce it to some smaller amount of queries (e.g. everything in range 871e064d5ffffff -> 871e06498ffffff, plus everything in range of 871e0649bffffff -> 871e06509ffffff... or in other words "larger than this h3 but smaller than this h3")
    2. How can I actually convert a range in metres to k-ring/hex-ring ranges?

    Thanks for your help!

    opened by mrousavy 6
  • h3js index find all children using index values

    h3js index find all children using index values

    Hello, Suppose we are storing h3 indexes in a database column. To perform a parent/child query I was thinking of using h3 indexes. Lets say we have this index 832834fffffffff. This cell's children are[ '8428341ffffffff', '8428343ffffffff', '8428345ffffffff', '8428347ffffffff', '8428349ffffffff', '842834bffffffff', '842834dffffffff']. What is the logic to tell if an h3index id is a child of another id. Is there any way that we can find a range of indexies that are child of the specific id. I already found https://github.com/uber/h3/issues/320 and https://stackoverflow.com/questions/53911322/is-the-h3index-ordered but could not find my answer. Thanks

    opened by am2222 5
  • Bump handlebars from 4.1.2 to 4.5.3

    Bump handlebars from 4.1.2 to 4.5.3

    Bumps handlebars from 4.1.2 to 4.5.3.

    Changelog

    Sourced from handlebars's changelog.

    v4.5.3 - November 18th, 2019

    Bugfixes:

    • fix: add "no-prototype-builtins" eslint-rule and fix all occurences - f7f05d7
    • fix: add more properties required to be enumerable - 1988878

    Chores / Build:

    • fix: use !== 0 instead of != 0 - c02b05f
    • add chai and dirty-chai and sinon, for cleaner test-assertions and spies, deprecate old assertion-methods - 93e284e, 886ba86, 0817dad, 93516a0

    Security:

    • The properties __proto__, __defineGetter__, __defineSetter__ and __lookupGetter__ have been added to the list of "properties that must be enumerable". If a property by that name is found and not enumerable on its parent, it will silently evaluate to undefined. This is done in both the compiled template and the "lookup"-helper. This will prevent new Remote-Code-Execution exploits that have been published recently.

    Compatibility notes:

    • Due to the security-fixes. The semantics of the templates using __proto__, __defineGetter__, __defineSetter__ and __lookupGetter__ in the respect that those expression now return undefined rather than their actual value from the proto.
    • The semantics have not changed in cases where the properties are enumerable, as in:
    {
      __proto__: 'some string'
    }
    
    • The change may be breaking in that respect, but we still only increase the patch-version, because the incompatible use-cases are not intended, undocumented and far less important than fixing Remote-Code-Execution exploits on existing systems.

    Commits

    v4.5.2 - November 13th, 2019

    Bugfixes

    • fix: use String(field) in lookup when checking for "constructor" - d541378
    • test: add fluent API for testing Handlebars - c2ac79c

    Compatibility notes:

    • no incompatibility are to be expected
    ... (truncated)
    Commits
    • c819c8b v4.5.3
    • 827c9d0 Update release notes
    • f7f05d7 fix: add "no-prototype-builtins" eslint-rule and fix all occurences
    • 1988878 fix: add more properties required to be enumerable
    • 886ba86 test/chore: add chai/expect and sinon to "runtime"-environment
    • 0817dad test: add sinon as global variable to eslint in the specs
    • 93516a0 test: add sinon.js for spies, deprecate current assertions
    • 93e284e chore: add chai and dirty-chai for better test assertions
    • c02b05f fix: use !== 0 instead of != 0
    • 8de121d v4.5.2
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 5
  • TypeScript regression

    TypeScript regression

    #55 added auto-generated TypeScript types, but it seems like some of the functions (e.g. h3ToGeoBoundary) that return an array of arrays (i.e. Array[]) don't type-check properly in TypeScript, since the compiler expects the outer Array to have a type parameter:

    https://github.com/uber/h3-js/blob/c5f653f300eee3f3c2f7aebcfd59812e24f40170/lib/h3core.js#L566

    The fix is likely to specify the inner-most type explicitly (e.g. Number[][]) in the JSDoc.

    opened by whaatt 5
  • Upgrade emscripten to 3.X.X?

    Upgrade emscripten to 3.X.X?

    The current emscripten (1.38.43) is ~3 years old now. The docker container used is also deprecated https://hub.docker.com/r/trzeci/emscripten. Can we migrate to the official emscripten and use a newer version?

    There are hosts of benefits and bug fixes from the past three years.

    opened by 4nthonylin 1
  • hexArea & edgeLength don't allow rad units

    hexArea & edgeLength don't allow rad units

    The documentation clearly states that functions edgeLength and hexArea allow for second parameter to be UNIT.rads for edgeLength or UNIT.rads2 for hexArea. However when calling these functions:

    h3.edgeLength(12, h3.UNIT.rads);
    h3.hexArea(12, h3.UNIT.rads2)
    

    an error is thrown:

    Unknown unit: rads

    Unknown unit: rads2

    opened by MatixYo 1
  • React-native won't compile because of the use of h3-js

    React-native won't compile because of the use of h3-js

    importing h3-js this way import * as h3 from "h3-js";

    would trigger the error below:

    [Sat May 08 2021 16:50:27.116]  ERROR    Error: Requiring module "node_modules/h3-js/dist/browser/h3-js.js", which threw an exception: ReferenceError: Can't find variable: document
    [Sat May 08 2021 16:50:27.132]  ERROR    ReferenceError: Can't find variable: document
    

    I am wondering if this could be easily fixed? I am reading that there is a node version of h3-js, how can I import it instead of the browser version?

    I tried to only import the function I was using at the time but I am still getting the same error

    import {geoToH3} from 'h3-js';
    

    I think the error is pointing to this code here in h3-js

      var readAsync;
    
      {
        if (document.currentScript) {
          scriptDirectory = document.currentScript.src;
        }
    
        if (scriptDirectory.indexOf("blob:") !== 0) {
          scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1);
        } else {
          scriptDirectory = "";
        }
    
    opened by johhnsmmith198 13
  • Incorrect/weird results from h3SetToMultiPolygon

    Incorrect/weird results from h3SetToMultiPolygon

    I'm getting some weird results from h3SetToMultiPolygon when passing large numbers of h3 indexes (in these examples the h3 cells are all adjacent). There are two issues:

    1. When the polygon array is returned there are a number of single point arrays. e.g.

    h3Ids: ["8132fffffffffff","812e7ffffffffff","81303ffffffffff","815a3ffffffffff","814f7ffffffffff","81733ffffffffff","81687ffffffffff","814afffffffffff","8133bffffffffff","812f3ffffffffff","814e7ffffffffff","8130fffffffffff","815afffffffffff","8132bffffffffff","814bbffffffffff","812e3ffffffffff","81777ffffffffff","814f3ffffffffff","814abffffffffff","81337ffffffffff","812efffffffffff","814e3ffffffffff","815abffffffffff","81327ffffffffff","814b7ffffffffff","812fbffffffffff","81773ffffffffff","814efffffffffff","81317ffffffffff","815b7ffffffffff","814a7ffffffffff","81333ffffffffff","815a7ffffffffff","81737ffffffffff","81323ffffffffff","814fbffffffffff","814b3ffffffffff","812f7ffffffffff","814ebffffffffff","81313ffffffffff","815b3ffffffffff","814a3ffffffffff","8123bffffffffff","81237ffffffffff","81233ffffffffff","8147bffffffffff","8146fffffffffff","8146bffffffffff","81223ffffffffff","81463ffffffffff","81473ffffffffff","81477ffffffffff","81467ffffffffff","815dbffffffffff","815d3ffffffffff","815cbffffffffff","815c3ffffffffff","8137bffffffffff","815bbffffffffff","81373ffffffffff","8136bffffffffff","81363ffffffffff","8171bffffffffff","81717ffffffffff","81713ffffffffff"]

    Gives this result: [ [ [ [ 43.816094965537175, 142.3058437365082 ], [ 47.94353494620575, 140.81932027711576 ], [ 48.30438780776227, 137.965723000237 ], [ 48.41801789173907, 134.76393627595755 ], [ 45.253613490980094, 131.7744009814935 ], [ 45.09643436908035, 125.98114176677377 ], [ 47.997962809385406, 122.1525950681968 ], [ 47.30945130281312, 116.21289563713783 ], [ 43.25414167974314, 115.50113901102061 ], [ 41.14827082786993, 119.13690952882241 ], [ 38.614966776615006, 118.5828850895855 ], [ 37.42985448428109, 118.86929883406582 ], [ 36.20528264541884, 121.690153924224 ], [ 36.005614448071924, 123.16276457697893 ], [ 32.66144519495384, 124.02055612683286 ], [ 29.89298533869355, 120.503393859958 ], [ 26.20027606045547, 121.34751445935747 ], [ 24.728661050965936, 119.64146543031175 ], [ 23.50895195973631, 117.99047716641068 ], [ 19.252194904738655, 118.80300158646772 ], [ 18.127070267319834, 123.02355515221002 ], [ 13.797500809062361, 123.85482415801255 ], [ 10.736966167684393, 120.449366342475 ], [ 6.2891846753414375, 121.26764633911117 ], [ 4.76343118357537, 125.5023153387887 ], [ 7.805398745803346, 129.0449200915637 ], [ 6.19767652780886, 133.49441060685513 ], [ 9.23145267029969, 137.1970727246292 ], [ 7.537486471095007, 141.69432910913807 ], [ 10.472716898667054, 145.410940917621 ], [ 8.701739974658008, 149.7748737561887 ], [ 4.084015752678338, 150.44123001544202 ], [ 2.3920322085174597, 154.598935323174 ], [ 5.189055516512115, 158.0067643262748 ], [ 3.50810422466813, 161.8156148096885 ], [ 6.119591258608643, 164.93539603741024 ], [ 4.4670316097845255, 168.3352524578736 ], [ 4.467031609784517, 168.3352524578736 ], [ 6.172978893164634, 172.0341823693935 ], [ 4.248592317017831, 175.46041201203371 ], [ 5.8899217543139155, 179.21716082489448 ], [ 5.889921754313889, 179.21716082489448 ], [ 2.9040374505798128, -178.0251966524985 ], [ 3.821024494330419, -174.31673738369324 ], [ 7.972793830841406, -173.38014762578527 ], [ 9.060308038526605, -169.29312998396932 ], [ 5.767146686378422, -166.16940101623453 ], [ 6.766536253596447, -161.77338167921764 ], [ 3.3357348575173495, -158.59967491814012 ], [ 4.260374459536216, -154.0294052002189 ], [ 8.71898308656318, -152.5335322367957 ], [ 9.628747217956542, -147.80006555587835 ], [ 14.110797540904425, -146.16007687374923 ], [ 17.737530353545214, -149.3676428224656 ], [ 22.166939007405805, -147.69594788211106 ], [ 25.669243623986258, -151.04796662686522 ], [ 29.891830084602514, -149.34707529879068 ], [ 30.56995088296885, -144.17342232410294 ], [ 34.454167617014946, -142.3232078622538 ], [ 37.68759229063255, -145.7463690434673 ], [ 41.20828589932378, -143.84631120128412 ], [ 44.09362423911827, -147.45009391663316 ], [ 43.44325276436555, -153.03739182353246 ], [ 43.44325276436556, -153.03739182353243 ], [ 46.9088746957617, -156.03631344405528 ], [ 46.51349897531834, -161.56979335131368 ], [ 49.895974148750696, -165.61336675442524 ], [ 49.05085282910133, -171.87311046039585 ], [ 44.74985555511408, -173.25136162888563 ], [ 43.33462463706693, -179.170112546831 ], [ 46.18001465709014, 175.62099681678237 ], [ 44.17622039141846, 169.66101739290986 ], [ 46.48282657751592, 163.91021485526238 ], [ 43.912304017571394, 158.38289640953528 ], [ 45.62266462732751, 152.54480605394903 ], [ 42.63340688235615, 147.81728377284588 ] ] ], [ [ [ 27.949605976503907, 142.4332217566576 ] ] ], [ [ [ 34.33115860097916, 132.30837745804206 ] ] ], [ [ [ 12.194726726167971, 160.7733897026288 ] ] ] ]

    The first polygon is accurate but the others are single points and seem unnecessary. Not a big deal as I can easily filter these out. This doesn't seem to happen at lower H3 resolutions.


    1. Occasionally I am only getting single point returns (i.e. no actual polygon).

    For example with these h3 ids: [ "816efffffffffff", "8126bffffffffff", "8148fffffffffff", "8113bffffffffff", "8122fffffffffff", "810c3ffffffffff", "8150bffffffffff", "815c3ffffffffff", "8126fffffffffff", "81493ffffffffff", "81363ffffffffff", "81457ffffffffff", "81233ffffffffff", "810c7ffffffffff", "8150fffffffffff", "815c7ffffffffff", "81273ffffffffff", "81497ffffffffff", "81367ffffffffff", "81237ffffffffff", "810cbffffffffff", "81513ffffffffff", "815cbffffffffff", "8149bffffffffff", "8136bffffffffff", "8123bffffffffff", "810cfffffffffff", "81517ffffffffff", "811c3ffffffffff", "815cfffffffffff", "816c3ffffffffff", "8127bffffffffff", "8136fffffffffff", "81463ffffffffff", "8151bffffffffff", "81703ffffffffff", "815d3ffffffffff", "81373ffffffffff", "81467ffffffffff", "811cbffffffffff", "81707ffffffffff", "815d7ffffffffff", "816cbffffffffff", "81283ffffffffff", "81377ffffffffff", "8146bffffffffff", "811cfffffffffff", "815dbffffffffff", "81287ffffffffff", "8137bffffffffff", "8146fffffffffff", "811d3ffffffffff", "816d3ffffffffff", "8128bffffffffff", "81473ffffffffff", "811d7ffffffffff", "81713ffffffffff", "8128fffffffffff", "81477ffffffffff", "81123ffffffffff", "811dbffffffffff", "81717ffffffffff", "816dbffffffffff", "81293ffffffffff", "8147bffffffffff", "81127ffffffffff", "81793ffffffffff", "810ebffffffffff", "8171bffffffffff", "81297ffffffffff", "81797ffffffffff", "8112bffffffffff", "816e3ffffffffff", "8129bffffffffff", "81483ffffffffff", "8179bffffffffff", "8112fffffffffff", "81447ffffffffff", "81223ffffffffff", "816e7ffffffffff", "81263ffffffffff", "81487ffffffffff", "81227ffffffffff", "81503ffffffffff", "816ebffffffffff", "81267ffffffffff", "8148bffffffffff", "81137ffffffffff", "8122bffffffffff", "81507ffffffffff", "815fbffffffffff", "814cbffffffffff", "812a7ffffffffff", "8139bffffffffff", "81453ffffffffff", "81677ffffffffff", "81547ffffffffff", "811b7ffffffffff", "812abffffffffff", "814cfffffffffff", "8167bffffffffff", "8154bffffffffff", "811bbffffffffff", "812afffffffffff", "814d3ffffffffff", "813a3ffffffffff", "8145bffffffffff", "8154fffffffffff", "812b3ffffffffff", "814d7ffffffffff", "81183ffffffffff", "813a7ffffffffff", "81277ffffffffff", "81553ffffffffff", "814dbffffffffff", "812b7ffffffffff", "81187ffffffffff", "813abffffffffff", "81557ffffffffff", "812bbffffffffff", "8118bffffffffff", "813afffffffffff", "816c7ffffffffff", "8155bffffffffff", "81743ffffffffff", "8118fffffffffff", "813b3ffffffffff", "8159bffffffffff", "81193ffffffffff", "813b7ffffffffff", "81563ffffffffff", "81197ffffffffff", "813bbffffffffff", "81067ffffffffff", "817c7ffffffffff", "81567ffffffffff", "81343ffffffffff", "810e3ffffffffff", "8119bffffffffff", "815e3ffffffffff", "816d7ffffffffff", "81383ffffffffff", "817cbffffffffff", "8156bffffffffff", "81347ffffffffff", "81753ffffffffff", "810e7ffffffffff", "815e7ffffffffff", "817cfffffffffff", "8156fffffffffff", "8134bffffffffff", "81663ffffffffff", "81757ffffffffff", "8180fffffffffff", "811a3ffffffffff", "815ebffffffffff", "8138bffffffffff", "8134fffffffffff", "81573ffffffffff", "81667ffffffffff", "81443ffffffffff", "8175bffffffffff", "810efffffffffff", "811a7ffffffffff", "815efffffffffff", "81077ffffffffff", "81353ffffffffff", "81577ffffffffff", "8166bffffffffff", "815f3ffffffffff", "811abffffffffff", "814c3ffffffffff", "81393ffffffffff", "81357ffffffffff", "8157bffffffffff", "8144bffffffffff", "810f7ffffffffff", "815f7ffffffffff", "811afffffffffff", "812a3ffffffffff", "8135bffffffffff", "8144fffffffffff", "81673ffffffffff", "81543ffffffffff", "811b3ffffffffff" ]

    I get: [ [ [ [ 43.44325276436555, -153.03739182353246 ] ] ], [ [ [ 14.48240061773311, -65.76882190787967 ] ] ], [ [ [ 19.358823435394214, -75.99854824376126 ] ] ], [ [ [ 8.931891500446854, -127.11406580207421 ] ] ], [ [ [ 59.16948256665965, -139.68359348160976 ] ] ], [ [ [ 40.975558199255886, -54.879012779249344 ] ] ], [ [ [ 31.285608665560563, -134.10648897177788 ] ] ], [ [ [ 29.30037465923499, 0.2609468260311339 ] ] ], [ [ [ 41.45713981733575, -138.450291223663 ] ] ], [ [ [ 29.82877615972559, -1.240802016513824 ] ] ], [ [ [ 31.877885956365837, -62.02252554784451 ] ] ], [ [ [ 11.545295975414758, -4.01399844347046 ] ] ] ]

    i.e. no actual polygon, just a series of points — seems like a bug?

    opened by pugsley 2
Releases(v4.0.0)
  • v4.0.0(Aug 23, 2022)

    First production release for H3 v4 🎉 . As noted below, most function names have changed, but the H3 indexes have not, so while using v4 will require code changes it should be 100% backwards compatible with existing data. See the 4x migration guide for more information.

    [4.0.0] - 2022-08-23

    Breaking Changes

    • Updated the core library to v4.0.0. This update renames the majority of the H3 functions. You can see a list of changed function names in the core library documentation. For the most part, upgrading to v4 for Javascript consumers should be a straightforward search & replace between the old names and the new. (#151, #144, #141, #139)
    • Added more cases in which JS errors may be thrown. In H3 v3, many functions would fail silently with invalid input, returning null or similar signal values. In H3 v4, we will throw descriptive errors for most instances of bad input. (#139)

    Changed

    • Add Typescript typechecking, generate types with tsc (#153)

    Fixed

    • Fail package publish if there are library changes (#148)

    Added

    • Added legacy API wrapper with Typescript types (#146)
    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-rc4(Aug 22, 2022)

    [4.0.0-rc4] - 2022-08-22

    Breaking changes

    • Updated the core library to v4.0.0-rc5. (#151)

    Changed

    • Add Typescript typechecking, generate types with tsc (#153)
    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-rc3(Aug 22, 2022)

  • v4.0.0-rc2(Aug 11, 2022)

    [4.0.0-rc2] - 2022-08-11

    Added

    • Added legacy API wrapper with Typescript types (#146)

    Legacy API

    H3 v4 renamed the majority of the functions in the library. To help ease migration from H3 v3 to H3 v4, we offer a legacy API wrapper at h3-js/legacy, which exports the v4 functions with the v3 names. Users are welcome to use the legacy API wrapper as a transitional support, but are encouraged to upgrade to the H3 v4 API as soon as possible.

    Note that the legacy API is not 100% backwards compatible - it's a thin wrapper on top of the v4 functions, so in cases where behavior has changed, the v4 behavior will be used. In particular, many of the v4 functions will throw errors for invalid input, where v3 functions would return null.

    Source code(tar.gz)
    Source code(zip)
  • v4.0.0-rc1(Jul 29, 2022)

    [4.0.0-rc1] - 2022-07-28

    First release candidate for H3 v4 🎉 . As noted below, most function names have changed, but the H3 indexes have not, so while using v4 will require code changes it should be 100% backwards compatible with existing data. See the 4x migration guide for more information.

    Added

    • Added vertex mode functions (#138)

    Breaking Changes

    • Updated the core library to v4.0.0-rc4. (#141)
    • Updated the core library to v4.0.0-rc2. This update renames the majority of the H3 functions. You can see a list of changed function names in the core library documentation. For the most part, upgrading to v4 for Javascript consumers should be a straightforward search & replace between the old names and the new. (#139)
    • Added more cases in which JS errors may be thrown. In H3 v3, many functions would fail silently with invalid input, returning null or similar signal values. In H3 v4, we will throw descriptive errors for most instances of bad input. (#139)
    Source code(tar.gz)
    Source code(zip)
  • v3.7.2(Apr 29, 2021)

  • v3.7.1(Mar 11, 2021)

  • v3.7.0(Oct 15, 2020)

    [3.7.0] - 2020-10-15

    Added

    • Added bindings for new area and distance functions (#93):
      • cellArea
      • exactEdgeLength
      • pointDist
    • All functions accepting H3 index input now also accept a [lowerBits, upperBits] tuple of 32-bit integers (#91)

    Fixed

    • Fixed type definition for UNITS (#94)

    Changed

    • Updated the core library to 3.7.1 (#93)
    Source code(tar.gz)
    Source code(zip)
  • v3.6.4(Jul 2, 2020)

    [3.6.4] - 2020-06-02

    Fixed

    • Fixed h3IsValid returning true on certain edge cases (#81)
    • Fix some polyfill edge cases (#86)

    Changed

    • Updated the core library to 3.6.3 - minor fixes for h3IsValid and compact (#81)
    • Updated the core library to 3.6.4 - reinstate new polyfill algorithm (#86)
    Source code(tar.gz)
    Source code(zip)
  • v3.6.3(Dec 11, 2019)

    [3.6.3] - 2019-12-10

    Fixed

    • Updated the core library to v3.6.2. This rolls back the polyfill algorithm to previous version; we'll roll forward again once we've fixed the known issues.
    Source code(tar.gz)
    Source code(zip)
  • v3.6.2(Nov 11, 2019)

    [3.6.2] - 2019-11-11

    Fixed

    • Improved TypeScript typedefs (#73)
    • Fix polyfill edge cases, improve perfomance (#74)

    Changed

    • Updated the core library to v3.6.1 (#74)
    Source code(tar.gz)
    Source code(zip)
  • v3.6.1(Sep 19, 2019)

  • v3.6.0(Sep 12, 2019)

    [3.6.0] - 2019-09-12

    Fixed

    • Removed unhandledRejection handling from emscripten build (#64)
    • Fixed TypeScript definition file, added a CI test to guard against regressions (#65)

    Changed

    • Updated the core library to v3.6.0 (#61)

    Added

    • Added bindings for getPentagonIndexes and h3ToCenterChild (#61)
    Source code(tar.gz)
    Source code(zip)
  • v3.5.0(Jul 24, 2019)

    [3.5.0] - 2019-07-24

    Added

    • Added h3GetFaces binding (#54)
    • Generated a TypeScript definition file from jsdoc comments (#55)

    Changed

    • Updated the core library to v3.5.0 (#52, #54)
    Source code(tar.gz)
    Source code(zip)
  • v3.4.3(Apr 2, 2019)

    [3.4.3] - 2019-04-01

    Added

    • Changed module exports to ES6 syntax (#41)
    • Added UMD bundle to published package (#41)
    • Added separate bundles with an Emscripten browser-only build (#43)
    Source code(tar.gz)
    Source code(zip)
  • v3.4.2(Feb 8, 2019)

  • v3.4.1(Jan 25, 2019)

  • v3.4.0(Jan 25, 2019)

  • v3.3.0(Jan 9, 2019)

  • v3.2.0(Nov 1, 2018)

  • v3.1.1(Aug 30, 2018)

    [3.1.1] - 2018-08-30

    Fixed

    • Updated the core library to v3.1.1, including fixes for polyfill and h3SetToMultiPolygon (#19)
    • Removed Emscripten Node error handling from built library, fixing stacktraces (#18)

    Added

    • Added generated API documentation to README (#17)
    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Aug 13, 2018)

    [3.1.0] - 2018-08-13

    Added

    • Added binding for h3Distance (#15)

    Changed

    • Updated the core library to 3.1.0 (#15)
    • Moved emscripten build to docker (#14)
    Source code(tar.gz)
    Source code(zip)
  • v3.0.2(Jul 26, 2018)

    [3.0.2] - 2018-07-26

    Changed

    • Updated the core library to v3.0.8 (#10)
    • Renamed names of h3.1 or h3-1 to h3 (#4)
    • Added engine support for Node 10 (#11)
    Source code(tar.gz)
    Source code(zip)
  • v3.0.1(Jun 18, 2018)

  • v3.0.0(Jun 18, 2018)

Owner
Uber Open Source
Open Source Software at Uber
Uber Open Source
WebGL2 powered geospatial visualization layers

deck.gl | Website WebGL2-powered, highly performant large-scale data visualization deck.gl is designed to simplify high-performance, WebGL-based visua

Vis.gl 10.5k Jan 8, 2023
Rasterio reads and writes geospatial raster datasets

Rasterio Rasterio reads and writes geospatial raster data. Geographic information systems use GeoTIFF and other formats to organize and store gridded,

Mapbox 1.9k Jan 7, 2023
gpdvega is a bridge between GeoPandas and Altair that allows to seamlessly chart geospatial data

gpdvega gpdvega is a bridge between GeoPandas a geospatial extension of Pandas and the declarative statistical visualization library Altair, which all

Ilia Timofeev 49 Jul 25, 2022
Geospatial Image Processing for Python

GIPPY Gippy is a Python library for image processing of geospatial raster data. The core of the library is implemented as a C++ library, libgip, with

GIPIT 83 Aug 19, 2022
leafmap - A Python package for geospatial analysis and interactive mapping in a Jupyter environment.

A Python package for geospatial analysis and interactive mapping with minimal coding in a Jupyter environment

Qiusheng Wu 1.4k Jan 2, 2023
GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.

Table of Contents What is GeoNode? Try out GeoNode Install Learn GeoNode Development Contributing Roadmap Showcase Most useful links Licensing What is

GeoNode Development Team 1.2k Dec 26, 2022
🌐 Local tile server for viewing geospatial raster files with ipyleaflet

?? Local Tile Server for Geospatial Rasters Need to visualize a rather large raster (gigabytes) you have locally? This is for you. A Flask application

Bane Sullivan 192 Jan 4, 2023
Minimum Bounding Box of Geospatial data

BBOX Problem definition: The spatial data users often are required to obtain the coordinates of the minimum bounding box of vector and raster data in

Ali Khosravi Kazazi 1 Sep 8, 2022
🌐 Local tile server for viewing geospatial raster files with ipyleaflet or folium

?? Local Tile Server for Geospatial Rasters Need to visualize a rather large (gigabytes) raster you have locally? This is for you. A Flask application

Bane Sullivan 192 Jan 4, 2023
The geospatial toolkit for redistricting data.

maup maup is the geospatial toolkit for redistricting data. The package streamlines the basic workflows that arise when working with blocks, precincts

Metric Geometry and Gerrymandering Group 60 Dec 5, 2022
A part of HyRiver software stack for handling geospatial data manipulations

Package Description Status PyNHD Navigate and subset NHDPlus (MR and HR) using web services Py3DEP Access topographic data through National Map's 3DEP

Taher Chegini 5 Dec 14, 2022
Enable geospatial data mining through Google Earth Engine in Grasshopper 3D, via its most recent Hops component.

AALU_Geo Mining This repository is produced for a masterclass at the Architectural Association Landscape Urbanism programme. Requirements Rhinoceros (

null 4 Nov 16, 2022
Specification for storing geospatial vector data (point, line, polygon) in Parquet

GeoParquet About This repository defines how to store geospatial vector data (point, lines, polygons) in Apache Parquet, a popular columnar storage fo

Open Geospatial Consortium 449 Dec 27, 2022
A Django application that provides country choices for use with forms, flag icons static files, and a country field for models.

Django Countries A Django application that provides country choices for use with forms, flag icons static files, and a country field for models. Insta

Chris Beaven 1.2k Jan 3, 2023
Implemented a Google Maps prototype that provides the shortest route in terms of distance

Implemented a Google Maps prototype that provides the shortest route in terms of distance, the fastest route, the route with the fewest turns, and a scenic route that avoids roads when provided a source and destination. The algorithms used were DFS, BFS, A*, and Iterative Depth First Search.

null 1 Dec 26, 2021
Example of animated maps in matplotlib + geopandas using entire time series of congressional district maps from UCLA archive. rendered, interactive version below

Example of animated maps in matplotlib + geopandas using entire time series of congressional district maps from UCLA archive. rendered, interactive version below

Apoorva Lal 5 May 18, 2022
ESMAC diags - Earth System Model Aerosol-Cloud Diagnostics Package

Earth System Model Aerosol-Cloud Diagnostics Package This Earth System Model (ES

Pacific Northwest National Laboratory 1 Jan 4, 2022
Raster-based Spatial Analysis for Python

?? xarray-spatial: Raster-Based Spatial Analysis in Python ?? Fast, Accurate Python library for Raster Operations ⚡ Extensible with Numba ⏩ Scalable w

makepath 649 Jan 1, 2023
Constraint-based geometry sketcher for blender

Geometry Sketcher Constraint-based sketcher addon for Blender that allows to create precise 2d shapes by defining a set of geometric constraints like

null 1.7k Jan 2, 2023