Public
Edited
May 20, 2024
9 stars
Also listed in…
H3
Insert cell
Insert cell
Insert cell
// Index a lat/lng point to an H3 index
h3.latLngToCell(20, 123, 2)
Insert cell
// Get the center of an H3 index as a lat/lng point
h3.cellToLatLng("8928342e20fffff")
Insert cell
// Get the vertices of an H3 index as lat/lng points.
// Passing "true" as the second parameter yields GeoJSON lng/lat points and a closed loop.
h3.cellToBoundary("8928342e20fffff", true)
Insert cell
Insert cell
// Get the children of an H3 index at the given (finer) resolution
h3.cellToChildren("8928342e20fffff", 10)
Insert cell
// Get the parent of an H3 index at the given (coarser) resolution
h3.cellToParent("8928342e20fffff", 7)
Insert cell
Insert cell
// Find all H3 indexes within a given distance from the origin (filled ring)
h3.gridDisk("8728342e2ffffff", 1)
Insert cell
// Find all H3 indexes within a given distance from the origin, grouped into hollow rings
// from innermost to outermost
h3.gridDiskDistances("8728342e2ffffff", 3)
Insert cell
// Get the distance in grid cells between two H3 indexes
h3.gridDistance("85283473fffffff", "8528362bfffffff")
Insert cell
// Get a path of cells between two H3 indexes
h3.gridPathCells("85283473fffffff", "8528362bfffffff")
Insert cell
Insert cell
// Get all H3 indexes within a geographic polygon. Inclusion is determined by whether the center
// of a given cell falls within the polygon.
h3.polygonToCells([[[37,-122], [36, -121], [36, -123]]], 5)
Insert cell
// Get the multipolygon (array of polygons) for a set of H3 indexes. Indexes are expected to
// be unique and all at the same resolution
h3.cellsToMultiPolygon(["85291a6ffffffff", "85291a6bfffffff", "852834d3fffffff"])
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more