0.1.2 • Published 5 months ago

@envisim/geojson-utils v0.1.2

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
5 months ago

npm package

@envisim/geojson-utils

A TypeScript library with utility functions for working with GeoJSON data.

Installation

npm install @envisim/geojson-utils

Usage

Package exposes the following entry points:

Default entry point

import { normalizeLongitude } from "@envisim/geojson-utils";

// Normalize the longitude to (-180, 180]
normalizeLongitude(150.0); //  150.0
normalizeLongitude(190.0); // -170.0

GeoJSON types

import type * as GJ from "@envisim/geojson-utils/geojson";
const p: GJ.Position = [0, 1];

Type guards

Type guards for GeoJSON types.

import { isCircle } from "@envisim/geojson-utils/type-guards";
const circle = { type: "Point", radius: 2, coordinates: [0, 0] };
isCircle(circle);

Geodesic segments

Geodesic segment operations using geographiclib-geodesic.

import { distance } from "@envisim/geojson-utils/geodesic";
distance([0, 0], [1, 0]);

Platé carrée segments

Platé carrée segment operations.

import { distance } from "@envisim/geojson-utils/plate-carree";
distance([0, 0], [1, 0]);

Rhumb segments

Rhumb segment operations.

import { distance } from "@envisim/geojson-utils/rhumb";
distance([0, 0], [1, 0]);
0.1.2

5 months ago

0.1.1

6 months ago

0.1.0

6 months ago