Class H3Polygon
Region operations that convert between GeoPolygon shapes and sets of H3 cells. All coordinates are in degrees.
public static class H3Polygon
- Inheritance
-
H3Polygon
- Inherited Members
Methods
FromCells(IEnumerable<H3Index>)
Merges a set of H3 cells into one or more polygons describing their outline, including holes.
public static IReadOnlyList<GeoPolygon> FromCells(IEnumerable<H3Index> cells)
Parameters
cellsIEnumerable<H3Index>The cells to merge. The Null sentinel is ignored.
Returns
- IReadOnlyList<GeoPolygon>
The resulting polygons, with vertices in degrees. The first loop of each polygon is the exterior; any subsequent loops are holes.
Exceptions
- ArgumentNullException
cellsis null.- H3Exception
The native operation failed.
ToCells(GeoPolygon, int)
Returns the set of H3 cells of the given resolution whose centers fall within
polygon.
public static H3Index[] ToCells(GeoPolygon polygon, int resolution)
Parameters
polygonGeoPolygonThe region to fill, in degrees.
resolutionintThe target H3 resolution (0-15).
Returns
- H3Index[]
The covering cells, with null padding slots removed. Order is not guaranteed.
Exceptions
- ArgumentNullException
polygonis null.- H3DomainException
The resolution was rejected by the native library.
- H3Exception
The native operation otherwise failed.
ToCellsExperimental(GeoPolygon, int, ContainmentMode)
Returns the set of H3 cells of the given resolution that satisfy the supplied
mode containment predicate against polygon.
[Experimental("H3NET0001")]
public static H3Index[] ToCellsExperimental(GeoPolygon polygon, int resolution, ContainmentMode mode)
Parameters
polygonGeoPolygonThe region to fill, in degrees.
resolutionintThe target H3 resolution (0-15).
modeContainmentModeThe containment predicate selecting which cells are returned.
Returns
- H3Index[]
The covering cells, with null padding slots removed. Order is not guaranteed.
Remarks
This API is experimental and may change in any future minor H3 version. Unlike the stable ToCells(GeoPolygon, int) (which always uses Center), this overload honors every ContainmentMode.
Exceptions
- ArgumentNullException
polygonis null.- H3DomainException
The resolution was outside 0-15, or
modewas an out-of-range cast (for example(ContainmentMode)99), which the native library rejects withE_OPTION_INVALID.- H3Exception
The native operation otherwise failed.