All Projects → uber → Geojson2h3

uber / Geojson2h3

Licence: apache-2.0
Conversion utilities between H3 indexes and GeoJSON

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Geojson2h3

xyz-spaces-python
Manage your XYZ Hub or HERE Data Hub spaces from Python.
Stars: ✭ 29 (-68.82%)
Mutual labels:  geojson, geospatial
geojson-mongo-import.py
Import GeoJSON file into MongoDB using Python
Stars: ✭ 20 (-78.49%)
Mutual labels:  geojson, geospatial
pygeoif
Basic implementation of the __geo_interface__
Stars: ✭ 44 (-52.69%)
Mutual labels:  geojson, geospatial
turf-go
A Go language port of Turf.js
Stars: ✭ 41 (-55.91%)
Mutual labels:  geojson, geospatial
Geoswift
The Swift Geometry Engine.
Stars: ✭ 1,267 (+1262.37%)
Mutual labels:  geospatial, geojson
skynet-scrub-server
Backing store for developmentseed/skynet-scrub
Stars: ✭ 13 (-86.02%)
Mutual labels:  geojson, geospatial
xyz-hub
XYZ Hub is a RESTful web service for the access and management of geospatial data.
Stars: ✭ 43 (-53.76%)
Mutual labels:  geojson, geospatial
krawler
A minimalist (geospatial) ETL
Stars: ✭ 51 (-45.16%)
Mutual labels:  geojson, geospatial
Magellan
Geo Spatial Data Analytics on Spark
Stars: ✭ 507 (+445.16%)
Mutual labels:  geospatial, geojson
Go Geom
Package geom implements efficient geometry types for geospatial applications.
Stars: ✭ 456 (+390.32%)
Mutual labels:  geospatial, geojson
pyturf
A modular geospatial engine written in python
Stars: ✭ 15 (-83.87%)
Mutual labels:  geojson, geospatial
Lawn
⛔ ARCHIVED ⛔ turf.js R client
Stars: ✭ 57 (-38.71%)
Mutual labels:  geospatial, geojson
geojson
Library for serializing the GeoJSON vector GIS file format
Stars: ✭ 171 (+83.87%)
Mutual labels:  geojson, geospatial
geojson
GeoJSON classes for R
Stars: ✭ 32 (-65.59%)
Mutual labels:  geojson, geospatial
de9im
DE-9IM spatial predicate library implemented in Javascript.
Stars: ✭ 22 (-76.34%)
Mutual labels:  geojson, geospatial
GeoJSON.jl
Utilities for working with GeoJSON data in Julia
Stars: ✭ 46 (-50.54%)
Mutual labels:  geojson, geospatial
L7
🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis framework which relies on Mapbox GL or AMap to render basemaps.
Stars: ✭ 2,517 (+2606.45%)
Mutual labels:  geospatial, geojson
Php Crud Api
Single file PHP script that adds a REST API to a SQL database
Stars: ✭ 2,904 (+3022.58%)
Mutual labels:  geospatial, geojson
Orb
Types and utilities for working with 2d geometry in Golang
Stars: ✭ 378 (+306.45%)
Mutual labels:  geospatial, geojson
Wellknown
WKT <-> GeoJSON
Stars: ✭ 15 (-83.87%)
Mutual labels:  geospatial, geojson

geojson2h3

Build Status Coverage Status

The geojson2h3 library includes a set of utilities for conversion between GeoJSON polygons and H3 hexagon indexes, using h3-js.

Installation

npm install geojson2h3

Example Usage

import geojson2h3 from 'geojson2h3';

const polygon = {
  type: 'Feature',
  geometry: {
    type: 'Polygon',
    coordinates: [[
      [-122.47485823276713, 37.85878356045377],
      [-122.47504834087829, 37.86196795698972],
      [-122.47845104316997, 37.86010614563313],
      [-122.47485823276713, 37.85878356045377]
    ]]
  }
};

const hexagons = geojson2h3.featureToH3Set(polygon, 10);
// -> ['8a2830855047fff', '8a2830855077fff', '8a283085505ffff', '8a283085506ffff']

const feature = geojson2h3.h3SetToFeature(hexagons);
// -> {type: 'Feature', properties: {}, geometry: {type: 'Polygon', coordinates: [...]}}

API Reference

geojson2h3


geojson2h3.featureToH3Set(feature, resolution) ⇒ Array.<String>

Convert a GeoJSON feature to a set of hexagons. Only hexagons whose centers fall within the feature will be included. Note that conversion from GeoJSON is lossy; the resulting hexagon set only approximately describes the original shape, at a level of precision determined by the hexagon resolution.

featureToH3Set

Kind: static method of geojson2h3
Returns: Array.<String> - H3 indexes

Param Type Description
feature Object Input GeoJSON: type must be either Feature or FeatureCollection, and geometry type must be either Polygon or MultiPolygon
resolution Number Resolution of hexagons, between 0 and 15

geojson2h3.h3ToFeature(hexAddress, [properties]) ⇒ Feature

Convert a single H3 hexagon to a Polygon feature

Kind: static method of geojson2h3
Returns: Feature - GeoJSON Feature object

Param Type Description
hexAddress String Hexagon address
[properties] Object Optional feature properties

geojson2h3.h3SetToFeature(hexagons, [properties]) ⇒ Feature

Convert a set of hexagons to a GeoJSON Feature with the set outline(s). The feature's geometry type will be either Polygon or MultiPolygon depending on the number of outlines required for the set.

h3SetToFeature

Kind: static method of geojson2h3
Returns: Feature - GeoJSON Feature object

Param Type Description
hexagons Array.<String> Hexagon addresses
[properties] Object Optional feature properties

geojson2h3.h3SetToMultiPolygonFeature(hexagons, [properties]) ⇒ Feature

Convert a set of hexagons to a GeoJSON MultiPolygon feature with the outlines of each individual hexagon.

h3SetToMultiPolygonFeature

Kind: static method of geojson2h3
Returns: Feature - GeoJSON Feature object

Param Type Description
hexagons Array.<String> Hexagon addresses
[properties] Object Optional feature properties

geojson2h3.h3SetToFeatureCollection(hexagons, [getProperties]) ⇒ FeatureCollection

Convert a set of hexagons to a GeoJSON FeatureCollection with each hexagon in a separate Polygon feature with optional properties.

h3SetToFeatureCollection

Kind: static method of geojson2h3
Returns: FeatureCollection - GeoJSON FeatureCollection object

Param Type Description
hexagons Array.<String> Hexagon addresses
[getProperties] function Optional function returning properties for a hexagon: f(h3Index) => Object

Development

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

yarn

To run the tests in both native ES6 (requires Node >= 6) and transpiled ES5:

yarn test

To format the code:

yarn prettier

To rebuild the API documentation in the README file:

yarn build-docs

Contributing

Pull requests and Github issues are welcome. Please include tests for new work, and keep the library test coverage at 100%. Before we can merge your changes, you must agree to the Uber Contributor License Agreement.

Legal and Licensing

The geojson2h3 library is licensed under the Apache 2.0 License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].