https://github.com/ziprecruiter/h3-go
Pure Go implementation of the spatial indexing library H3.
https://github.com/ziprecruiter/h3-go
golang h3 spatial
Last synced: 6 months ago
JSON representation
Pure Go implementation of the spatial indexing library H3.
- Host: GitHub
- URL: https://github.com/ziprecruiter/h3-go
- Owner: ZipRecruiter
- License: apache-2.0
- Created: 2024-12-20T18:18:18.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-04-04T16:08:34.000Z (6 months ago)
- Last Synced: 2025-04-04T17:23:40.313Z (6 months ago)
- Topics: golang, h3, spatial
- Language: Go
- Homepage:
- Size: 58.6 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# h3-go
This is a reimplementation of the [H3](https://github.com/uber/h3) spatial indexing library in pure Go (i.e. without using CGO to wrap the existing C++ library).
## Design goals
1. **Pure Go**: The library should be usable in any Go environment without requiring any additional dependencies. Notably, CGO should not be required.
2. **Performance**: The library should be fast enough to be usable in production applications.
3. **Idiomatic Go API**: The library should have an API that feels natural to Go developers.## Status
The library is in the early stages of development. We are implementing the core functionality of the H3 library, but not all features are available yet. The API is also subject to change.
Some core pieces of functionality are implemented:
- [x] Basic H3 index/cell Go types
- [x] Conversion between lat/lon and H3 indexes
- [x] Grid Disk algorithmOther important features are not yet implemented:
- [ ] Clean up public API
- [ ] Grid Ring algorithm
- [ ] Performance optimizations, including microbenchmarking## Usage
### Convert a lat/lon to an H3 index:
```go
package mainimport (
"github.com/ziprecruiter/h3-go/pkg/h3"
)func main() {
lat := 37.775938728915946
lon := -122.41795063018799
resolution := 9
ll := h3.NewLatLng(lat, lon)
h3Index, err := h3.NewCellFromLatLng(ll, resolution)
if err != nil {
panic(err)
}println(h3Index)
}
```