1.1.0 • Published 2 years ago

@sakitam-gis/affine v1.1.0

Weekly downloads
-
License
BSD 3-Clause
Repository
github
Last release
2 years ago

Affine

CI npm version npm downloads Coverage Status

Matrices describing affine transformation of the plane.

Install

npm i @sakitam-gis/affine -S

import Affine from '@sakitam-gis/affine'

Usage

The 3x3 augmented affine transformation matrix for transformations in two dimensions is illustrated below.

| x |   | a  b  c | | x |
| y | = | d  e  f | | y |
| 1 |   | 0  0  1 | | 1 |

Matrices can be created by passing the values a, b, c, d, e, f to the Affine constructor or by using its identity(), translation(), scale() class methods.

GIS

raster extent: west, south, east, north raster size: width, height

const width = 256; // tile width
const height = 256; // tile height
const t = Affine.translation(west, north);
const s = Affine.scale((east - west) / width, (south - north) / height);

const geoTransform = t.multiply(s).toArray();