UNPKG

s2-tools

Version:

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

65 lines 1.52 kB
import { D2R, PJD_NODATUM, R2D } from '../constants'; /** Base class for all projections */ export class ProjectionBase { name = 'longlat'; projName; static names = ['longlat', 'identity']; datumCode = 'none'; datumType = PJD_NODATUM; datumParams = [0, 0, 0, 0, 0, 0, 0]; srsCode = ''; // these are all variables must have a default value across all projections long0 = 0; long1 = 0; lat0 = 0; lat1 = 0; lat2 = 0; latTs; a = 0; b = 0; e = 0; x0 = 0; y0 = 0; k; k0 = 1; rf = 0; rA = false; rc; es = 0; ep2 = 0; alpha; gamma; zone; rectifiedGridAngle; utmSouth = false; toMeter; units = 'm'; fromGreenwich = 0; approx = false; axis = 'enu'; nadgrids = '@null'; grids; sphere = false; ellps = 'wgs84'; // Ellipsoid name /** @param params - projection specific parameters */ constructor(params) { Object.assign(this, params ?? {}); } /** * Forward projection from x-y to lon-lat. In this case, radians to degrees * @param p - Vector Point. This is a placeholder for a lon-lat WGS84 point */ forward(p) { p.x *= R2D; p.y *= R2D; } /** * Inverse projection from lon-lat to x-y. In this case, degrees to radians * @param p - Vector Point. This is a placeholder for a lon-lat WGS84 point */ inverse(p) { p.x *= D2R; p.y *= D2R; } } //# sourceMappingURL=base.js.map