7.11.0 • Published 9 months ago

@basemaps/geo v7.11.0

Weekly downloads
86
License
MIT
Repository
github
Last release
9 months ago

@basemaps/geo

Utility functions to work with QuadKeys, Tiles and Projections.

Bounds and intersections

import { Bounds } from '@basemaps/geo';

const bounds = new Bounds(128, 128, 256, 256);
const boundsB = new Bounds(0, 0, 256, 256);

bounds.intersects(boundsB); // true

bounds.intersection(boundsB); // { x: 128, y: 128, width: 128, height: 128}

Typing for generic point and sizes

import { Point, Size, BoundingBox } from '@basemaps/geo';

const p: Point = { x: 5, y: 5 };
const s: Size = { width: 200, height: 500 };
const box: BoundingBox = { ...p, ...s };

QuadKey utilities

import {QuadKey} from '@basemaps/geo';


QuadKey.children('3') // ['30', '31', '32', '33']

QuadKey.fromTile({ x: 3, y: 2, z: 2 } // '31'

Tile Matrix Sets

import { GoogleTms } from '@basemaps/geo/build/tms/google';

/** Convert tile offsets into pixel coordinates */
GoogleTms.tileToPixels(1, 1); // { x: 256, y: 256 }

/** Convert a tile into the upper left point in Google  */
GoogleTms.tileToSource({ x: 0, y: 0, z: 0 }); // { x: -20037508.3427892, y: 20037508.3427892 }

Epsg Helpers

import { Epsg } from '@basemaps/geo';

Epsg.Google.toEpsgCode(); // `EPSG:3857`
Epsg.Google.toUrn(); // `urn:ogc:def:crs:EPSG:3857`
Epsg.parse('3857'); // Epsg.Google
Epsg.get(3857); // Epsg.Google
7.11.0

9 months ago

7.4.0

1 year ago

7.5.0

12 months ago

7.1.0

1 year ago

7.0.0

2 years ago

6.43.0

2 years ago

6.44.0

2 years ago

6.41.0

2 years ago

6.40.0

2 years ago

6.37.0

3 years ago

6.32.1

3 years ago

6.31.0

3 years ago

6.28.1

3 years ago

6.26.0

3 years ago

6.25.0

3 years ago

6.21.1

3 years ago

6.24.2

3 years ago

6.10.0

4 years ago

6.9.1

4 years ago

6.8.0

4 years ago

6.0.0

4 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.23.0

4 years ago

4.24.0

4 years ago

4.22.0

4 years ago

4.20.0

4 years ago

4.19.0

5 years ago

4.18.0

5 years ago

4.17.0

5 years ago

4.16.0

5 years ago

4.15.0

5 years ago

4.11.1

5 years ago

4.11.0

5 years ago

4.8.0

5 years ago

4.7.0

5 years ago

4.6.0

5 years ago

4.4.0

5 years ago

4.1.0

5 years ago

4.0.0

5 years ago

3.5.0

5 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.2.0

5 years ago

2.0.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.0.0

5 years ago