Skip to main content

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#

Constructors#

constructor#

• new S2GeometryProvider(_level?)

Create a new S2 geometry provider instance.

Parameters#

NameTypeDefault value
_levelnumber17

Overrides#

GeometryProviderBase.constructor

Defined in#

api/S2GeometryProvider.ts:25

Methods#

bboxToCellIds#

â–¸ bboxToCellIds(sw, ne): string[]

Convert a geodetic bounding box to the the minimum set of cell ids containing the bounding box.

Parameters#

NameTypeDescription
swLngLatSouth west corner of bounding box.
neLngLatNorth east corner of bounding box.

Returns#

string[]

Array of cell ids.

Overrides#

GeometryProviderBase.bboxToCellIds

Defined in#

api/S2GeometryProvider.ts:28


getAdjacent#

â–¸ getAdjacent(cellId): string[]

Get the cell ids of all adjacent cells.

Parameters#

NameTypeDescription
cellIdstringId of cell.

Returns#

string[]

Array of cell ids. No specific order is guaranteed.

Overrides#

GeometryProviderBase.getAdjacent

Defined in#

api/S2GeometryProvider.ts:33


getVertices#

â–¸ getVertices(cellId): LngLat[]

Get the vertices of a cell.

Parameters#

NameTypeDescription
cellIdstringId of cell.

Returns#

LngLat[]

Unclosed clockwise polygon.

Overrides#

GeometryProviderBase.getVertices

Defined in#

api/S2GeometryProvider.ts:64


lngLatToCellId#

â–¸ lngLatToCellId(lngLat): string

Convert geodetic coordinates to a cell id.

Parameters#

NameTypeDescription
lngLatLngLatLongitude, latitude to convert.

Returns#

string

Cell id for the longitude, latitude.

Overrides#

GeometryProviderBase.lngLatToCellId

Defined in#

api/S2GeometryProvider.ts:76