0

I want to make a system where a user will be able to draw a hexagonal grid. The regions and their coordinates will be stored in Database. We are thinking to implement H3 libary for this. How will be the library help is in making H3 hexagons all over the country?

I have made a node project with h3-js library but can't figure how which function to actually render or draw hexagons over a projection/map.

2 Answers 2

2

In general, to render H3 cells, you can get the vertexes using h3.h3ToGeoBoundary(cell) (v3) or h3.cellToBoundary(cell) (v4). This gives you an array of [lat, lng] pairs; passing true as the second argument gives you [lng, lat] pairs and closed loops appropriate for GeoJSON. You can use the geojson2h3 library to facilitate the process of converting one or more H3 cells to GeoJSON, which can be rendered to a map using Mapbox, Google Maps, or a variety of other mapping tools.

See https://observablehq.com/@nrabinowitz/h3-tutorial-heatmap-rendering?collection=@nrabinowitz/h3-tutorial for an example of rendering cells to a map using Mapbox.

Sign up to request clarification or add additional context in comments.

1 Comment

About "multi-resolution cover", or subpaving, see impossibility to use hexagons at math.stackexchange.com/a/4829230/70274
1

Recently I found this tuto for create custom for with CSS grid, I think it's will help you for your problem : https://css-tricks.com/css-grid-and-custom-shapes-part-1/#aa-css-grid-of-hexagons

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.