UNPKG

gis-tools-ts

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

229 lines 9.49 kB
import type { S1Angle } from '../s1/angle.js'; import type { Face, MValue, Properties, S2CellId, VectorPoint } from '../index.js'; /** * Convert a lon-lat coord to an XYZ Point using the left-hand-rule * @param ll - LonLat vector point in degrees * @returns The XYZ Point */ export declare function pointFromLonLat<M extends MValue = Properties>(ll: VectorPoint<M>): VectorPoint<M>; /** * Convert a lon-lat coord to an XYZ Point using the right-hand-rule. * This function takes longitude and latitude as input and returns the corresponding XYZ coordinates. * @param ll - LonLat vector point in degrees * @returns The XYZ Point representing the provided longitude and latitude. */ export declare function pointFromLonLatGL<M extends MValue = Properties>(ll: VectorPoint<M>): VectorPoint<M>; /** * Convert a u-v coordinate to an XYZ Point. * @param face - The face of the S2 cell. * @param u - The u-coordinate on the face. * @param v - The v-coordinate on the face. * @param m - M-Value data * @returns The XYZ Point representing the given u-v coordinates. */ export declare function pointFromUV<M extends MValue = Properties>(face: Face, u: number, v: number, m?: M): VectorPoint<M>; /** * Convert an s-t coordinate to an XYZ Point. * @param face - The face of the S2 cell. * @param s - The s-coordinate on the face. * @param t - The t-coordinate on the face. * @param m - M-Value data * @returns The XYZ Point representing the given s-t coordinates. */ export declare function pointFromST<M extends MValue = Properties>(face: Face, s: number, t: number, m?: M): VectorPoint<M>; /** * Convert an i-j coordinate to an XYZ Point. * @param face - The face of the S2 cell. * @param i - The i-coordinate on the face. * @param j - The j-coordinate on the face. * @returns The XYZ Point representing the given i-j coordinates. */ export declare function pointFromIJ(face: Face, i: number, j: number): VectorPoint; /** * Convert an S2CellID to an XYZ Point. * @param id - The S2CellID to convert. * @returns The XYZ Point representing the given S2CellID. */ export declare function pointFromS2CellID(id: S2CellId): VectorPoint; /** * Convert an Face-U-V coord to an XYZ Point using the right-hand-rule * @param face - The face of the S2 cell. * @param u - The u-coordinate on the face. * @param v - The v-coordinate on the face. * @returns The XYZ Point representing the given Face-U-V coordinates. */ export declare function pointFromUVGL(face: Face, u: number, v: number): VectorPoint; /** * Convert an Face-S-T coord to an XYZ Point using the right-hand-rule * @param face - The face of the S2 cell. * @param s - The s-coordinate on the face. * @param t - The t-coordinate on the face. * @returns The XYZ Point representing the given Face-S-T coordinates. */ export declare function pointFromSTGL(face: Face, s: number, t: number): VectorPoint; /** * Convert an XYZ Point to a Face-U-V coord * @param xyz - The XYZ Point to convert. * @returns - The Face-U-V coordinates representing the given XYZ Point. */ export declare function pointToUV(xyz: VectorPoint): [face: Face, u: number, v: number]; /** * Convert an XYZ Point to a Face-S-T coord * @param xyz - The XYZ Point to convert. * @returns - The Face-S-T coordinates representing the given XYZ Point. */ export declare function pointToST(xyz: VectorPoint): [face: Face, s: number, t: number]; /** * Convert an XYZ Point to a Face-I-J coord * @param xyz - The XYZ Point to convert. * @param level - The zoom level of the result. If not provided, the result will have 30 bits of precision. * @returns The Face-I-J coordinates representing the given XYZ Point. */ export declare function pointToIJ(xyz: VectorPoint, level?: number): [face: Face, i: number, j: number]; /** * Convert an XYZ Point to a lon-lat coord * @param xyz - The XYZ Point to convert. * @returns The lon-lat coordinates representing the given XYZ Point. */ export declare function pointToLonLat<M extends MValue = Properties>(xyz: VectorPoint<M>): VectorPoint<M>; /** * Convert an XYZ Point to an S2CellID * @param xyz - The XYZ Point to convert. * @returns The S2CellID representing the given XYZ Point. */ export declare function pointToS2CellID(xyz: VectorPoint): S2CellId; /** * Take an XYZ Point and add another XYZ Point to it * @param a - The XYZ Point to add to. * @param b - The XYZ Point to add. * @returns - The XYZ Point with the added XYZ Point. */ export declare function pointAdd(a: VectorPoint, b: VectorPoint): VectorPoint; /** * Take an XYZ Point and add another XYZ Point to it * @param a - The XYZ Point to add to. * @param b - The XYZ Point to add. */ export declare function pointAddMut(a: VectorPoint, b: VectorPoint): void; /** * Take an XYZ Point and add an n to each component * @param xyz - The XYZ Point to add to. * @param n - The amount to add. * @returns - The XYZ Point with the added amount. */ export declare function pointAddScalar(xyz: VectorPoint, n: number): VectorPoint; /** * Take an XYZ Point and subtract another XYZ Point from it * @param a - The XYZ Point to subtract from. * @param b - The XYZ Point to subtract. * @returns - The XYZ Point with the subtracted XYZ Point. */ export declare function pointSub(a: VectorPoint, b: VectorPoint): VectorPoint; /** * Take an XYZ Point and subtract an n from each component * @param xyz - The XYZ Point to subtract from. * @param n - The amount to subtract. * @returns - The XYZ Point with the subtracted amount. */ export declare function pointSubScalar(xyz: VectorPoint, n: number): VectorPoint; /** * Take an XYZ Point and multiply it by another XYZ Point * @param a - The XYZ Point to multiply. * @param b - The XYZ Point to multiply. * @returns - The XYZ Point with the multiplied XYZ Point. */ export declare function pointMul(a: VectorPoint, b: VectorPoint): VectorPoint; /** * Take an XYZ Point and multiply each component by n * @param xyz - The XYZ Point to multiply. * @param n - The amount to multiply. * @returns - The XYZ Point with the multiplied amount. */ export declare function pointMulScalar(xyz: VectorPoint, n: number): VectorPoint; /** * Take an XYZ Point and divide it by another XYZ Point * @param a - The XYZ Point to divide. * @param b - The XYZ Point to divide by. * @returns - The XYZ Point with the multiplied XYZ Point. */ export declare function pointDiv(a: VectorPoint, b: VectorPoint): VectorPoint; /** * Take an XYZ Point and divide each component by n * @param xyz - The XYZ Point to divide. * @param n - The amount to divide by. * @returns - The XYZ Point with the multiplied amount. */ export declare function pointDivScalar(xyz: VectorPoint, n: number): VectorPoint; /** * Take an XYZ Point and divide each component by n * @param xyz - The XYZ Point to divide. * @param n - The amount to divide by. */ export declare function pointDivMutScalar(xyz: VectorPoint, n: number): void; /** * Take an XYZ Point and divide each component by its length * @param xyz - The XYZ Point to divide. * @returns - The XYZ Point with the divided amount. */ export declare function pointNormalize<M extends MValue = Properties>(xyz: VectorPoint<M>): VectorPoint<M>; /** * Get the length of the XYZ Point * @param xyz - The XYZ Point * @returns - The length of the XYZ Point */ export declare function pointLength(xyz: VectorPoint): number; /** * Get the squared length of the XYZ Point with itself * @param xyz - The XYZ Point * @returns - The squared length of the XYZ Point */ export declare function pointNorm2(xyz: VectorPoint): number; /** * Invert the XYZ Point * @param xyz - The XYZ Point * @returns - The inverted XYZ Point */ export declare function pointInvert<M extends MValue = Properties>(xyz: VectorPoint<M>): VectorPoint<M>; /** * dot returns the standard dot product of a and b. * @param a - The first XYZ Point * @param b - The second XYZ Point * @returns - The dot product of the two XYZ Points */ export declare function pointDot(a: VectorPoint, b: VectorPoint): number; /** * Get the cross product of two XYZ Points * @param a - The first XYZ Point * @param b - The second XYZ Point * @returns - The cross product of the two XYZ Points */ export declare function pointCross(a: VectorPoint, b: VectorPoint): VectorPoint; /** * Get the distance between two XYZ Points using Earth's size * @param a - The first XYZ Point * @param b - The second XYZ Point * @param equatorial - The equatorial radius (default: EARTH_RADIUS_EQUATORIAL) * @param polar - The polar radius (default: EARTH_RADIUS_POLAR) * @returns - The distance between the two XYZ Points */ export declare function pointDistancePlanet(a: VectorPoint, b: VectorPoint, equatorial?: number, polar?: number): number; /** * Get the distance between two XYZ Points * @param a - The first XYZ Point * @param b - The second XYZ Point * @returns - The raw distance between the two XYZ Points. Highly inaccurate for large distances */ export declare function pointDistance(a: VectorPoint, b: VectorPoint): number; /** * @param a - The first XYZ Point * @param b - The second XYZ Point * @returns - The angle between the two XYZ Points */ export declare function pointAngle(a: VectorPoint, b: VectorPoint): S1Angle; /** * Find the S2 Hilbert Face of the XYZ Point [0, 6) * @param xyz - The XYZ Point * @returns - The S2 Hilbert Face */ export declare function pointGetFace(xyz: VectorPoint): number; //# sourceMappingURL=point.d.ts.map