UNPKG

@loaders.gl/3d-tiles

Version:

3D Tiles, an open standard for streaming massive heterogeneous 3D geospatial datasets.

27 lines 1.16 kB
// loaders.gl // SPDX-License-Identifier: MIT // Copyright vis.gl contributors import { getS2BoundaryFlatFromS2Cell } from "./converters/s2-to-boundary.js"; import { getS2LngLatFromS2Cell } from "./s2geometry/s2-geometry.js"; import { getS2Cell } from "./s2geometry/s2-cell-utils.js"; // GEOMETRY /** * Retrieve S2 geometry center * @param s2Token {string} A string that is the cell's hex token * @returns {[number, number]} Longitude and Latitude coordinates of the S2 cell's center */ export function getS2LngLat(s2Token) { const s2cell = getS2Cell(s2Token); return getS2LngLatFromS2Cell(s2cell); } /** * Get a polygon with corner coordinates for an s2 cell * @param tokenOrKey {string} A string that is the cell's hex token or the Hilbert quad key (containing /) * @return {Float64Array} - a simple polygon in flat array format: [lng0, lat0, lng1, lat1, ...] * - the polygon is closed, i.e. last coordinate is a copy of the first coordinate */ export function getS2BoundaryFlat(tokenOrKey) { const s2cell = getS2Cell(tokenOrKey); return getS2BoundaryFlatFromS2Cell(s2cell); } //# sourceMappingURL=s2-geometry-functions.js.map