{"id":13412988,"url":"https://github.com/uber/h3-go","last_synced_at":"2025-06-11T17:39:56.162Z","repository":{"id":37790199,"uuid":"145076038","full_name":"uber/h3-go","owner":"uber","description":"Go bindings for H3, a hierarchical hexagonal geospatial indexing system","archived":false,"fork":false,"pushed_at":"2024-08-26T15:37:42.000Z","size":257,"stargazers_count":299,"open_issues_count":7,"forks_count":59,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-08-26T18:31:44.566Z","etag":null,"topics":["geospatial","go","golang","h3","hexagon","spatial-indexing","uber"],"latest_commit_sha":null,"homepage":"https://uber.github.io/h3/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uber.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-17T05:32:07.000Z","updated_at":"2024-08-26T15:37:10.000Z","dependencies_parsed_at":"2024-08-26T18:28:39.317Z","dependency_job_id":null,"html_url":"https://github.com/uber/h3-go","commit_stats":{"total_commits":72,"total_committers":14,"mean_commits":5.142857142857143,"dds":0.5277777777777778,"last_synced_commit":"7df7f22f168ae7da2f0671e75601a84a4d5e3dd0"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fh3-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fh3-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fh3-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fh3-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uber","download_url":"https://codeload.github.com/uber/h3-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243635198,"owners_count":20322896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geospatial","go","golang","h3","hexagon","spatial-indexing","uber"],"created_at":"2024-07-30T20:01:32.000Z","updated_at":"2025-06-11T17:39:56.154Z","avatar_url":"https://github.com/uber.png","language":"Go","funding_links":[],"categories":["C","Geographic","地理"],"sub_categories":["Search and Analytic Databases","检索及分析资料库"],"readme":"\u003cimg align=\"right\" src=\"https://uber.github.io/img/h3Logo-color.svg\" alt=\"H3 Logo\" width=\"200\"\u003e\n\n![Build](https://github.com/uber/h3-go/workflows/Build/badge.svg?branch=master)\n[![Coverage Status](https://coveralls.io/repos/github/uber/h3-go/badge.svg)](https://coveralls.io/github/uber/h3-go)\n[![Go Report Card](https://goreportcard.com/badge/github.com/uber/h3-go/v4)](https://goreportcard.com/report/github.com/uber/h3-go)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n[![GoDoc](http://img.shields.io/badge/go-doc-blue.svg)](https://godoc.org/github.com/uber/h3-go)\n[![H3 Version](https://img.shields.io/badge/h3-v4.2.1-blue.svg)](https://github.com/uber/h3/releases/tag/v4.2.1)\n\n# H3-Go\n\nThis library provides Golang bindings for the\n[H3 Core Library](https://github.com/uber/h3). For API reference, see the\n[H3 Documentation](https://uber.github.io/h3/).\n\n**This is v4 of this library, supporting H3 v4.**\n\nCheck out [v3](https://github.com/uber/h3-go/tree/v3.7.1) or checkout the git tag for the version you need.\n\n**Migrating from v3?**\n\nCheck out [v3 to v4 migration guide](https://h3geo.org/docs/library/migrating-3.x).\nThere have been no breaking changes to the format of H3 indexes.  Indexes\ngenerated by older versions can be parsed in v4, and vice-versa.\n\n# Usage\n\n## Prerequisites\n\nH3-Go requires [CGO](https://golang.org/cmd/cgo/) (`CGO_ENABLED=1`) in order to\nbe built. Go should do the right thing when including this library:\n\n\u003e The cgo tool is enabled by default for native builds on systems where it is\n\u003e expected to work. It is disabled by default when cross-compiling. You can\n\u003e control this by setting the CGO_ENABLED environment variable when running the go\n\u003e tool: set it to 1 to enable the use of cgo, and to 0 to disable it. The go tool\n\u003e will set the build constraint \"cgo\" if cgo is enabled. The special import \"C\"\n\u003e implies the \"cgo\" build constraint, as though the file also said \"// +build\n\u003e cgo\". Therefore, if cgo is disabled, files that import \"C\" will not be built by\n\u003e the go tool. (For more about build constraints see\n\u003e \u003chttps://golang.org/pkg/go/build/#hdr-Build_Constraints\u003e).\n\nIf you see errors/warnings like _\"build constraints exclude all Go files...\"_,\nthen the `cgo` build constraint is likely disabled; try setting `CGO_ENABLED=1`\nenvironment variable in your `go build` step.\n\n## Installation\n\n```bash\ngo get github.com/uber/h3-go/v4\n```\n\n## Quickstart\n\n```go\nimport \"github.com/uber/h3-go/v4\"\n\nfunc ExampleLatLngToCell() {\n latLng := h3.NewLatLng(37.775938728915946, -122.41795063018799)\n resolution := 9 // between 0 (biggest cell) and 15 (smallest cell)\n\n cell := h3.LatLngToCell(latLng, resolution)\n\n fmt.Printf(\"%s\", cell)\n // Output:\n // 8928308280fffff\n}\n\n```\n\n# C API\n\n## Notes\n\n* `LatLng` returns `Lat` and `Lng` as degrees, instead of radians.\n* H3 C API function prefixes of `get` have been dropped in support of Golang's\n `Getter` [naming style](https://golang.org/doc/effective_go.html#Getters).\n* Convenience methods have been added to various types where that type was the\n  main or only argument.\n\n## Bindings\n\n| C API                        | Go API                                                    |\n|------------------------------|-----------------------------------------------------------|\n| `latLngToCell`               | `LatLngToCell`, `LatLng#Cell`                             |\n| `cellToLatLng`               | `CellToLatLng`, `Cell#LatLng`                             |\n| `cellToBoundary`             | `CellToBoundary`, `Cell#Boundary`                         |\n| `gridDisk`                   | `GridDisk`, `Cell#GridDisk`                               |\n| `gridDisksUnsafe`            | `GridDisksUnsafe`                                         |\n| `gridDiskDistances`          | `GridDiskDistances`, `Cell#GridDiskDistances`             |\n| `gridDiskDistancesSafe`      | `GridDiskDistancesSafe`, `Cell#GridDiskDistancesSafe`     |\n| `gridDiskDistancesUnsafe`    | `GridDiskDistancesUnsafe`, `Cell#GridDiskDistancesUnsafe` |\n| `gridRingUnsafe`             | `GridRingUnsafe`, `Cell#GridRingUnsafe`                   |\n| `polygonToCells`             | `PolygonToCells`, `GeoPolygon#Cells`                      |\n| `cellsToMultiPolygon`        | `CellsToMultiPolygon`                                     |\n| `degsToRads`                 | `DegsToRads`                                              |\n| `radsToDegs`                 | `RadsToDegs`                                              |\n| `greatCircleDistance`        | `GreatCircleDistance* (3/3)`                              |\n| `getHexagonAreaAvg`          | `HexagonAreaAvg* (3/3)`                                   |\n| `cellArea`                   | `CellArea* (3/3)`                                         |\n| `getHexagonEdgeLengthAvg`    | `HexagonEdgeLengthAvg* (2/2)`                             |\n| `exactEdgeLength`            | `EdgeLength* (3/3)`                                       |\n| `getNumCells`                | `NumCells`                                                |\n| `getRes0Cells`               | `Res0Cells`                                               |\n| `getPentagons`               | `Pentagons`                                               |\n| `getResolution`              | `Resolution`                                              |\n| `getBaseCellNumber`          | `BaseCellNumber`, `Cell#BaseCellNumber`                   |\n| `stringToH3`                 | `IndexFromString`, `Cell#UnmarshalText`                   |\n| `h3ToString`                 | `IndexToString`, `Cell#String`, `Cell#MarshalText`        |\n| `isValidCell`                | `Cell#IsValid`                                            |\n| `cellToParent`               | `Cell#Parent`, `Cell#ImmediateParent`                     |\n| `cellToChildren`             | `Cell#Children` `Cell#ImmediateChildren`                  |\n| `cellToCenterChild`          | `Cell#CenterChild`                                        |\n| `compactCells`               | `CompactCells`                                            |\n| `uncompactCells`             | `UncompactCells`                                          |\n| `isResClassIII`              | `Cell#IsResClassIII`                                      |\n| `isPentagon`                 | `Cell#IsPentagon`                                         |\n| `getIcosahedronFaces`        | `Cell#IcosahedronFaces`                                   |\n| `areNeighborCells`           | `Cell#IsNeighbor`                                         |\n| `cellsToDirectedEdge`        | `Cell#DirectedEdge`                                       |\n| `isValidDirectedEdge`        | `DirectedEdge#IsValid`                                    |\n| `getDirectedEdgeOrigin`      | `DirectedEdge#Origin`                                     |\n| `getDirectedEdgeDestination` | `DirectedEdge#Destination`                                |\n| `directedEdgeToCells`        | `DirectedEdge#Cells`                                      |\n| `originToDirectedEdges`      | `Cell#DirectedEdges`                                      |\n| `directedEdgeToBoundary`     | `DirectedEdge#Boundary`                                   |\n| `cellToVertex`               | `CellToVertex`                                            |\n| `cellToVertexes`             | `CellToVertexes`                                          |\n| `vertexToLatLng`             | `VertexToLatLng`                                          |\n| `isValidVertex`              | `IsValidVertex`                                           |\n| `gridDistance`               | `GridDistance`, `Cell#GridDistance`                       |\n| `gridPathCells`              | `GridPath`, `Cell#GridPath`                               |\n| `cellToLocalIj`              | `CellToLocalIJ`                                           |\n| `localIjToCell`              | `LocalIJToCell`                                           |\n\n## CGO\n\nThe H3 C source code and header files are copied into this project to optimize\nfor portability. `h3-go` can be imported into any Go project for any platform\nthat CGO supports.\n\n# Contributing\n\nPull requests and Github issues are welcome.  Please read our [contributing\nguide](./CONTRIBUTING.md) for more information.\n\n## Legal and Licensing\n\nH3-Go is licensed under the [Apache 2.0 License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Fh3-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuber%2Fh3-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Fh3-go/lists"}