{"id":13426306,"url":"https://github.com/uber/geojson2h3","last_synced_at":"2025-06-11T17:39:57.628Z","repository":{"id":39042665,"uuid":"138346796","full_name":"uber/geojson2h3","owner":"uber","description":"Conversion utilities between H3 indexes and GeoJSON","archived":false,"fork":false,"pushed_at":"2023-07-21T19:07:30.000Z","size":326,"stargazers_count":232,"open_issues_count":6,"forks_count":22,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-21T21:16:34.801Z","etag":null,"topics":["geojson","geospatial","h3","hexagon","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uber.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-06-22T20:46:11.000Z","updated_at":"2025-05-03T20:08:12.000Z","dependencies_parsed_at":"2023-10-11T01:11:03.538Z","dependency_job_id":"2e25b504-ffb9-4267-89f1-1a34107278c9","html_url":"https://github.com/uber/geojson2h3","commit_stats":{"total_commits":46,"total_committers":6,"mean_commits":7.666666666666667,"dds":0.6521739130434783,"last_synced_commit":"eada4ab9db3ff04a6fb029d29e669deda5b203e0"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/uber/geojson2h3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fgeojson2h3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fgeojson2h3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fgeojson2h3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fgeojson2h3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uber","download_url":"https://codeload.github.com/uber/geojson2h3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fgeojson2h3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259308161,"owners_count":22837974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geojson","geospatial","h3","hexagon","javascript"],"created_at":"2024-07-31T00:01:31.450Z","updated_at":"2025-06-11T17:39:57.594Z","avatar_url":"https://github.com/uber.png","language":"JavaScript","readme":"\u003c!-- this file is generated by a template,\nplease edit doc-files/README.md.tmpl --\u003e\n\n# geojson2h3\n\n[![test](https://github.com/uber/geojson2h3/workflows/test/badge.svg)](https://github.com/uber/geojson2h3/actions)\n[![Coverage Status](https://coveralls.io/repos/github/uber/geojson2h3/badge.svg?branch=master)](https://coveralls.io/github/uber/geojson2h3?branch=master)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n[![npm version](https://badge.fury.io/js/geojson2h3.svg)](https://badge.fury.io/js/geojson2h3)\n\nThe `geojson2h3` library includes a set of utilities for conversion between GeoJSON polygons and [H3 hexagon indexes](https://h3geo.org), using [h3-js](https://github.com/uber/h3-js).\n\n-   Post **bug reports or feature requests** to the [Github Issues page](https://github.com/uber/geojson2h3/issues)\n-   Ask **questions** by posting to the [H3 tag on StackOverflow](https://stackoverflow.com/questions/tagged/h3)\n\n## Installation\n\n```\nnpm install geojson2h3\n```\n\n## Example Usage\n\n```javascript\nimport geojson2h3 from 'geojson2h3';\n\nconst polygon = {\n  type: 'Feature',\n  geometry: {\n    type: 'Polygon',\n    coordinates: [[\n      [-122.47485823276713, 37.85878356045377],\n      [-122.47504834087829, 37.86196795698972],\n      [-122.47845104316997, 37.86010614563313],\n      [-122.47485823276713, 37.85878356045377]\n    ]]\n  }\n};\n\nconst hexagons = geojson2h3.featureToH3Set(polygon, 10);\n// -\u003e ['8a2830855047fff', '8a2830855077fff', '8a283085505ffff', '8a283085506ffff']\n\nconst feature = geojson2h3.h3SetToFeature(hexagons);\n// -\u003e {type: 'Feature', properties: {}, geometry: {type: 'Polygon', coordinates: [...]}}\n```\n\n## API Reference\n\n\u003ca name=\"module_geojson2h3\"\u003e\u003c/a\u003e\n\n## geojson2h3\n\n* [geojson2h3](#module_geojson2h3)\n    * [.featureToH3Set(feature, resolution, [options])](#module_geojson2h3.featureToH3Set) ⇒ \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e\n    * [.h3ToFeature(hexAddress, [properties])](#module_geojson2h3.h3ToFeature) ⇒ \u003ccode\u003eFeature\u003c/code\u003e\n    * [.h3SetToFeature(hexagons, [properties])](#module_geojson2h3.h3SetToFeature) ⇒ \u003ccode\u003eFeature\u003c/code\u003e\n    * [.h3SetToMultiPolygonFeature(hexagons, [properties])](#module_geojson2h3.h3SetToMultiPolygonFeature) ⇒ \u003ccode\u003eFeature\u003c/code\u003e\n    * [.h3SetToFeatureCollection(hexagons, [getProperties])](#module_geojson2h3.h3SetToFeatureCollection) ⇒ \u003ccode\u003eFeatureCollection\u003c/code\u003e\n\n\n* * *\n\n\u003ca name=\"module_geojson2h3.featureToH3Set\"\u003e\u003c/a\u003e\n\n### geojson2h3.featureToH3Set(feature, resolution, [options]) ⇒ \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e\nConvert a GeoJSON feature to a set of hexagons. *Only hexagons whose centers\nfall within the feature will be included.* Note that conversion from GeoJSON\nis lossy; the resulting hexagon set only approximately describes the original\nshape, at a level of precision determined by the hexagon resolution.\n\nIf the polygon is small in comparison with the chosen resolution, there may be\nno cell whose center lies within it, resulting in an empty set. To fall back\nto a single H3 cell representing the centroid of the polygon in this case, use\nthe `ensureOutput` option.\n\n![featureToH3Set](./doc-files/featureToH3Set.png)\n\n**Kind**: static method of [\u003ccode\u003egeojson2h3\u003c/code\u003e](#module_geojson2h3)  \n**Returns**: \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e - H3 indexes  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| feature | \u003ccode\u003eObject\u003c/code\u003e | Input GeoJSON: type must be either `Feature` or                              `FeatureCollection`, and geometry type must be                              either `Polygon` or `MultiPolygon` |\n| resolution | \u003ccode\u003eNumber\u003c/code\u003e | Resolution of hexagons, between 0 and 15 |\n| [options] | \u003ccode\u003eObject\u003c/code\u003e | Options |\n| [options.ensureOutput] | \u003ccode\u003eBoolean\u003c/code\u003e | Whether to ensure that at least one                              cell is returned in the set |\n\n\n* * *\n\n\u003ca name=\"module_geojson2h3.h3ToFeature\"\u003e\u003c/a\u003e\n\n### geojson2h3.h3ToFeature(hexAddress, [properties]) ⇒ \u003ccode\u003eFeature\u003c/code\u003e\nConvert a single H3 hexagon to a `Polygon` feature\n\n**Kind**: static method of [\u003ccode\u003egeojson2h3\u003c/code\u003e](#module_geojson2h3)  \n**Returns**: \u003ccode\u003eFeature\u003c/code\u003e - GeoJSON Feature object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| hexAddress | \u003ccode\u003eString\u003c/code\u003e | Hexagon address |\n| [properties] | \u003ccode\u003eObject\u003c/code\u003e | Optional feature properties |\n\n\n* * *\n\n\u003ca name=\"module_geojson2h3.h3SetToFeature\"\u003e\u003c/a\u003e\n\n### geojson2h3.h3SetToFeature(hexagons, [properties]) ⇒ \u003ccode\u003eFeature\u003c/code\u003e\nConvert a set of hexagons to a GeoJSON `Feature` with the set outline(s). The\nfeature's geometry type will be either `Polygon` or `MultiPolygon` depending on\nthe number of outlines required for the set.\n\n![h3SetToFeature](./doc-files/h3SetToFeature.png)\n\n**Kind**: static method of [\u003ccode\u003egeojson2h3\u003c/code\u003e](#module_geojson2h3)  \n**Returns**: \u003ccode\u003eFeature\u003c/code\u003e - GeoJSON Feature object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| hexagons | \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e | Hexagon addresses |\n| [properties] | \u003ccode\u003eObject\u003c/code\u003e | Optional feature properties |\n\n\n* * *\n\n\u003ca name=\"module_geojson2h3.h3SetToMultiPolygonFeature\"\u003e\u003c/a\u003e\n\n### geojson2h3.h3SetToMultiPolygonFeature(hexagons, [properties]) ⇒ \u003ccode\u003eFeature\u003c/code\u003e\nConvert a set of hexagons to a GeoJSON `MultiPolygon` feature with the\noutlines of each individual hexagon.\n\n![h3SetToMultiPolygonFeature](./doc-files/h3SetToFeatureCollection.png)\n\n**Kind**: static method of [\u003ccode\u003egeojson2h3\u003c/code\u003e](#module_geojson2h3)  \n**Returns**: \u003ccode\u003eFeature\u003c/code\u003e - GeoJSON Feature object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| hexagons | \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e | Hexagon addresses |\n| [properties] | \u003ccode\u003eObject\u003c/code\u003e | Optional feature properties |\n\n\n* * *\n\n\u003ca name=\"module_geojson2h3.h3SetToFeatureCollection\"\u003e\u003c/a\u003e\n\n### geojson2h3.h3SetToFeatureCollection(hexagons, [getProperties]) ⇒ \u003ccode\u003eFeatureCollection\u003c/code\u003e\nConvert a set of hexagons to a GeoJSON `FeatureCollection` with each hexagon\nin a separate `Polygon` feature with optional properties.\n\n![h3SetToFeatureCollection](./doc-files/h3SetToFeatureCollection.png)\n\n**Kind**: static method of [\u003ccode\u003egeojson2h3\u003c/code\u003e](#module_geojson2h3)  \n**Returns**: \u003ccode\u003eFeatureCollection\u003c/code\u003e - GeoJSON FeatureCollection object  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| hexagons | \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e | Hexagon addresses |\n| [getProperties] | \u003ccode\u003efunction\u003c/code\u003e | Optional function returning properties                                    for a hexagon: f(h3Index) =\u003e Object |\n\n\n* * *\n\n\n## Development\n\nThe `geojson2h3` library uses `yarn` as the preferred package manager. To install the dev dependencies, just run:\n\n    yarn\n\nTo run the tests in both native ES6 (requires Node \u003e= 6) and transpiled ES5:\n\n    yarn test\n\nTo format the code:\n\n    yarn prettier\n\nTo rebuild the API documentation in the README file:\n\n    yarn build-docs\n\n## Contributing\n\nPull requests and [Github issues](https://github.com/uber/geojson2h3/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](http://cla-assistant.io/uber/geojson2h3).\n\n## Legal and Licensing\n\nThe `geojson2h3` library is licensed under the [Apache 2.0 License](https://github.com/uber/geojson2h3/blob/master/LICENSE).\n","funding_links":[],"categories":["JavaScript","javascript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Fgeojson2h3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuber%2Fgeojson2h3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Fgeojson2h3/lists"}