🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@basemaps/geo

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@basemaps/geo

Utility functions to work with QuadKeys, Tiles and Projections.

8.0.0
latest
Source
npm
Version published
Weekly downloads
377
138.61%
Maintainers
2
Weekly downloads
 
Created
Source

@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

FAQs

Package last updated on 11 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts