Skip to content

ZipRecruiter/h3-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

h3-go

This is a reimplementation of the 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:

  • Basic H3 index/cell Go types
  • Conversion between lat/lon and H3 indexes
  • Grid Disk algorithm

Other 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:

package main

import (
	"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)
}

About

Pure Go implementation of the spatial indexing library H3.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages