pocketken.H3
4.5.0
dotnet add package pocketken.H3 --version 4.5.0
NuGet\Install-Package pocketken.H3 -Version 4.5.0
<PackageReference Include="pocketken.H3" Version="4.5.0" />
<PackageVersion Include="pocketken.H3" Version="4.5.0" />
<PackageReference Include="pocketken.H3" />
paket add pocketken.H3 --version 4.5.0
#r "nuget: pocketken.H3, 4.5.0"
#:package pocketken.H3@4.5.0
#addin nuget:?package=pocketken.H3&version=4.5.0
#tool nuget:?package=pocketken.H3&version=4.5.0
<img align="right" src="https://uber.github.io/img/h3Logo-color.svg" alt="H3 Logo" width="200">
H3.net: A port of Uber's Hexagonal Hierarchical Geospatial Indexing System to C#
This is a port of Uber's H3 library to C# with most of the polygon functionality based on NetTopologySuite instead of in-library implementations. It supports netstandard2.0, netstandard2.1, net8.0 and net10.0, and is (mostly) based on release 4.5.0 of the C library.
H3 is a geospatial indexing system using a hexagonal grid that can be (approximately) subdivided into finer and finer hexagonal grids, combining the benefits of a hexagonal grid with S2's hierarchical subdivisions.
Installing
Available on nuget.org as pocketken.H3.
PM> Install-Package pocketken.H3 -Version 4.5.0
See CHANGES.md for a list of changes between releases.
Unity
Use the compiled netstandard2.1 (or netstandard2.0) assembly from the nuget package, e.g. via NuGetForUnity. As of 4.5.0 the netstandard targets depend only on NetTopologySuite (plus Microsoft.Bcl.HashCode for netstandard2.0) — there is no System.Text.Json dependency chain to fight with, and the library contains no unsafe code or runtime code generation, so it should be IL2CPP/AOT friendly. H3IndexJsonConverter is only available on the net8.0+ targets. Note that consuming the library as source in Unity is not supported (it relies on a Roslyn source generator and current C# language features); consume the compiled assembly instead.
Documentation
Upstream documentation is available at https://h3geo.org/. Basic getting-started documentation for this port of the library is available here. I have tried to make the library work and feel more "C# like" using value types, operators, extension methods, enumerables vs. arrays and so on, but some things may be implemented more or less as straight ports of the upstream library.
While the majority of the core H3 API should be here in one form or another, there's still the odd gap in terms of documentation and tests to validate behaviour vs. upstream. PRs to improve code, tests and documentation are definitely welcome and appreciated, although please keep in mind I am quite busy these days and may be a bit slow to respond. Sorry in advance!
Contributing
The model types (H3Index, CoordIJK, FaceIJK, LatLng, ...) are mutable structs: mutating methods modify the receiver in place and return a copy for value-flow usage. Never chain mutating calls unless you consume the result — x.DownAperture7Clockwise().ToNeighbour(d); applies the second mutation to a discarded temporary copy; write sequential statements instead. Pure members are annotated readonly.
Benchmarks
See these likely-out-of-date benchmarks, or you can run them yourself - e.g.:
dotnet run --configuration Release --project .\test\H3.Benchmarks\H3.Benchmarks.csproj --join --framework net10.0
To compare the current working tree against the published 4.0.0 package, see test/H3.CompareBenchmarks.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Bcl.HashCode (>= 6.0.0)
- NetTopologySuite (>= 2.6.0)
-
.NETStandard 2.1
- NetTopologySuite (>= 2.6.0)
-
net10.0
- NetTopologySuite (>= 2.6.0)
-
net8.0
- NetTopologySuite (>= 2.6.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on pocketken.H3:
| Package | Downloads |
|---|---|
|
Deploy.LaunchPad.Core
Shared code for LaunchPad framework. |
|
|
Florence
Package Description |
|
|
Eutopia
Package Description |
|
|
Florence.Notebooks
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.