sakitam-gis / affine

Matrices describing affine transformation of the plane.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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();

About

Matrices describing affine transformation of the plane.

License:Other


Languages

Language:JavaScript 58.0%Language:TypeScript 42.0%