docs(h3-hexagon-layer): add GeoJSON FeatureCollection example#10317
Open
SMC17 wants to merge 1 commit into
Open
docs(h3-hexagon-layer): add GeoJSON FeatureCollection example#10317SMC17 wants to merge 1 commit into
SMC17 wants to merge 1 commit into
Conversation
When ingesting a GeoJSON FeatureCollection where each feature's
properties carries the H3 cell ID (a common export pattern from
geopandas, QGIS, h3-py, and custom spatial-index pipelines), the
default getHexagon accessor (object => object.hexagon) silently
returns undefined because GeoJSON parsers surface features as
{type, geometry, properties} objects.
This adds a worked example to the H3HexagonLayer docs showing the
getHexagon: d => d.properties.h3_id override so the recipe is
discoverable without reading the source.
Tested against a 1,665-feature H3 res-5 FeatureCollection export.
Docs-only; no code touched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When ingesting a GeoJSON
FeatureCollectionwhere each feature'spropertiescarries the H3 cell ID (a common export pattern fromgeopandas, QGIS,h3-py, and custom spatial-index pipelines), the defaultgetHexagonaccessor (object => object.hexagon) silently returnsundefinedbecause GeoJSON parsers surface features as{type, geometry, properties}objects.This adds a small worked example to the
H3HexagonLayerdocs page showing thegetHexagon: d => d.properties.h3_idoverride so the pattern is discoverable without reading the source.Motivation
The existing examples on the page assume the data shape
[{hex, count}, …]. Many H3-cell pipelines emit GeoJSON instead, and the override needed for theH3HexagonLayerto render those is one line — but currently has to be derived rather than copied. This PR makes the recipe copy-pastable.Tested against a real-world 1,665-feature GeoJSON
FeatureCollectionof H3 res-5 cells.Change
docs/api-reference/geo-layers/h3-hexagon-layer.md— adds one new subsection ("Consuming H3 cells from a GeoJSON FeatureCollection") with a 13-lineH3HexagonLayerexample, immediately after the existingTabsblock and before## Installation.Docs-only; no code touched. +32 / -0 on the one file.