https://github.com/mmadfox/go-h3geo-dist
H3-geo distributed cells
https://github.com/mmadfox/go-h3geo-dist
distributed geo geospatial h3 h3dist uber uber-h3
Last synced: 9 months ago
JSON representation
H3-geo distributed cells
- Host: GitHub
- URL: https://github.com/mmadfox/go-h3geo-dist
- Owner: mmadfox
- License: mit
- Created: 2021-12-27T14:05:36.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-11T11:33:40.000Z (over 3 years ago)
- Last Synced: 2024-12-19T05:34:05.741Z (11 months ago)
- Topics: distributed, geo, geospatial, h3, h3dist, uber, uber-h3
- Language: Go
- Homepage:
- Size: 47.9 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go-cn - H3GeoDist - h3geo-dist) (地理 / 检索及分析资料库)
- awesome-go-cn - H3GeoDist - h3geo-dist) [![godoc][D]](https://godoc.org/github.com/mmadfox/go-h3geo-dist) (地理 / 检索及分析资料库)
- awesome-go-plus - H3GeoDist - Distribution of Uber H3geo cells by virtual nodes.  (Geographic / Search and Analytic Databases)
- fucking-awesome-go - H3GeoDist - Distribution of Uber H3geo cells by virtual nodes. (Geographic / Search and Analytic Databases)
- awesome-go - H3GeoDist - Distribution of Uber H3geo cells by virtual nodes. (Geographic / Search and Analytic Databases)
- awesome-go - H3GeoDist - Distribution of Uber H3geo cells by virtual nodes. (Geographic / Search and Analytic Databases)
- awesome-go-extra - go-h3geo-dist - geo distributed cells|0|1|0|2021-12-27T14:05:36Z|2022-05-11T11:33:40Z| (Geographic / Advanced Console UIs)
- awesome-go - H3GeoDist - Distribution of Uber H3geo cells by virtual nodes. (Geographic / Search and Analytic Databases)
- awesome-go - H3GeoDist - Distribution of Uber H3geo cells by virtual nodes. (Geographic / Search and Analytic Databases)
- awesome-go-with-stars - H3GeoDist - Distribution of Uber H3geo cells by virtual nodes. (Geographic / Search and Analytic Databases)
- awesome-go - H3GeoDist - Distribution of Uber H3geo cells by virtual nodes. (Geographic / Search and Analytic Databases)
README
# H3-geo distributed cells
[](https://pkg.go.dev/github.com/mmadfox/go-h3geo-dist)
[](https://coveralls.io/github/mmadfox/go-h3geo-dist?branch=main&1)
[](https://goreportcard.com/report/github.com/mmadfox/go-h3geo-dist)
Distribution of [Uber H3geo](https://h3geo.org/) cells by nodes
Prerequisites
-------
[H3-Go requires CGO ](https://github.com/uber/h3-go#prerequisites)
Install
-------
With a correctly configured Go env:
```
go get github.com/mmadfox/go-h3geo-dist
```
Examples
--------
```go
package main
import (
"fmt"
h3geodist "github.com/mmadfox/go-h3geo-dist"
"github.com/uber/h3-go/v3"
)
func main() {
level := h3geodist.Level1
h3dist, err := h3geodist.New(level)
if err != nil {
panic(err)
}
_ = h3dist.Add("127.0.0.1")
_ = h3dist.Add("127.0.0.2")
_ = h3dist.Add("127.0.0.3")
// iterate over all cells level one
h3geodist.Iter(level, func(index uint, cell h3.H3Index) {
// find a node by h3geo cell
dcell, ok := h3dist.Lookup(cell)
fmt.Printf("h3dist.Lookup: cell=%v, host=%s, found=%v\n", cell, dcell.Host, ok)
})
h3dist.LookupMany([]h3.H3Index{
h3.FromString("821fa7fffffffff"),
h3.FromString("821f9ffffffffff"),
h3.FromString("81973ffffffffff"),
h3.FromString("81f07ffffffffff"),
}, func(c h3geodist.Cell) bool {
fmt.Printf("h3dist.LookupMany: cell=%v, host=%s\n", c.H3ID, c.Host)
return true
})
h3dist.Remove("127.0.0.1")
h3dist.Remove("127.0.0.2")
h3dist.Remove("127.0.0.3")
}
```