geojson-web-map-coordinates-cutter
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

geojson-web-map-coordinates-cutter

This repo addresses the problem that we get geometries from web maps (e.g. leaflet or mapbox) that cross the antimeridian - any number of times.

The case is well explained in RFC7946 3.1.9.. This implementation is pretty generic and works for all geometries. Does the RFC show exactly your case?

Then you would like to filter (drop) the returned "-180/180**"-segments.

Install

$ npm install geojson-web-map-coordinates-cutter
$ npm install @types/geojson --save-dev # when using typescript

Usage

import Cutter from 'geojson-web-map-coordinates-cutter'

const cutter = new Cutter()
const geometry = cutter.cut([[-590, 0], [570, 0]])
console.log(JSON.stringify(geometry))
// "type": "MultiLineString", "coordinates": [[[130, 0], [180, 0]], [[-180, 0], [180, 0]], [[-180, 0], [-150, 0]]] ...

Readme

Keywords

none

Package Sidebar

Install

npm i geojson-web-map-coordinates-cutter

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

15.7 kB

Total Files

7

Last publish

Collaborators

  • nicopack