Class: S2GeometryProvider
api.S2GeometryProvider
classdesc Geometry provider based on S2 cells.
example
class MyDataProvider extends DataProviderBase { ...}
const geometryProvider = new S2GeometryProvider();const dataProvider = new MyDataProvider(geometryProvider);Hierarchy#
↳
S2GeometryProvider
Constructors#
constructor#
• new S2GeometryProvider(_level?)
Create a new S2 geometry provider instance.
Parameters#
| Name | Type | Default value |
|---|---|---|
_level | number | 17 |
Overrides#
GeometryProviderBase.constructor
Defined in#
Methods#
bboxToCellIds#
â–¸ bboxToCellIds(sw, ne): string[]
Convert a geodetic bounding box to the the minimum set of cell ids containing the bounding box.
Parameters#
| Name | Type | Description |
|---|---|---|
sw | LngLat | South west corner of bounding box. |
ne | LngLat | North east corner of bounding box. |
Returns#
string[]
Array of cell ids.
Overrides#
GeometryProviderBase.bboxToCellIds
Defined in#
getAdjacent#
â–¸ getAdjacent(cellId): string[]
Get the cell ids of all adjacent cells.
Parameters#
| Name | Type | Description |
|---|---|---|
cellId | string | Id of cell. |
Returns#
string[]
Array of cell ids. No specific order is guaranteed.
Overrides#
GeometryProviderBase.getAdjacent
Defined in#
getVertices#
â–¸ getVertices(cellId): LngLat[]
Get the vertices of a cell.
Parameters#
| Name | Type | Description |
|---|---|---|
cellId | string | Id of cell. |
Returns#
LngLat[]
Unclosed clockwise polygon.
Overrides#
GeometryProviderBase.getVertices
Defined in#
lngLatToCellId#
â–¸ lngLatToCellId(lngLat): string
Convert geodetic coordinates to a cell id.
Parameters#
| Name | Type | Description |
|---|---|---|
lngLat | LngLat | Longitude, latitude to convert. |
Returns#
string
Cell id for the longitude, latitude.
Overrides#
GeometryProviderBase.lngLatToCellId