@tsl-tuertscher/gis-helpers
v1.6.1
Published
Helper functions for geographic information system
Downloads
18
Maintainers
Readme
gis-helpers
Helper functions for geographic information system
Install
npm install @tsl-tuertscher/gis-helpers
Usage
import {
getBearing,
getBearing360,
getDistance,
getRadialCoordinates,
getPointInPolygon,
getBoundingRectangle,
getPointInTriangle,
getPointInBoundingRectangle,
simplify
} from '@tsl-tuertscher/gis-helpers';
import { Vector } from '@tsl-tuertscher/gis-helpers/vector';
import {
fromTileX,
fromTileY,
toTileX,
toTileY,
tile2lon,
tile2lat,
lon2tile,
lat2tile
} from './slippy-tiles';
import { Matrix } from '@tsl-tuertscher/gis-helpers/matrix';
...
const distance = getDistance([9, 47.5], [13, 49.2]);
const bearing = getBearing([9, 47.5], [13, 49.2]);
const coordinate = getRadialCoordinates([9, 47.5], 45, 1000);
...
const vector = new Vector(1,2,3);
const newVector = vector.innerProduct(new Vector(4, 5, 6));
...
const x = fromTileX(269, 9);
const y = fromTileY(179, 9);
const lon = tile2lon(269, 9);
const lat = tile2lat(179, 9);
const tileX = lon2tile(9.34, 12, false);
const tileY = lat2tile(47.34, 12, false);
...
const mat = new Matrix();
mat.setRotationsMatrixY(Math.PI / 2);
const vec = mat.multiply(new Vector(1,2,3));