Socket
Book a DemoInstallSign in
Socket

@linzjs/geojson

Package Overview
Dependencies
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@linzjs/geojson

## GeoJSON computation

latest
Source
npmnpm
Version
8.0.0
Version published
Maintainers
3
Created
Source

@linzjs/geojson

GeoJSON computation

Utility functions for working with GeoJSON multi polygons and bounding boxes. In particular for handling the anti-meridian.

Usage

Wgs84

import { Wgs84 } from '@linzjs/geojson';

assert(Wgs84.normLon(-163.12345 - 720) == -163.12345;

assert(Wgs84.crossesAM(-175, 175));

assert(Wgs84.delta(-175, 170) == -15);

assert(deepEqual(Wgs84.union([175, -42, -178, -41], [-170, -43, -160, -42]), [175, -43, -160, -41]));

MultiPolygon

import { clipMultipolygon, multiPolygonToWgs84 } from '@linzjs/geojson';
import * as Proj from 'proj4';

// polygons clipped to bounding box; no degenerate edges
const clipped = clipMultipolygon(polygons, [-2, -2, 1, 1]);

const nztmToWgs84 = Proj('epsg:2193', 'epsg:4326').forward;

// nztm polygons converted to wgs84 split at anti-meridian
const splitPolys = multiPolygonToWgs84(nztmPolygons, nztmToWgs84);

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