1.1.0 • Published 3 years ago

geojson-web-map-coordinates v1.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
3 years ago

geojson-web-map-coordinates

This repo addresses the problem that web maps (e.g. leaflet or mapbox) don't display LINES from one point to the closest other. Sometimes the rendering turns around the world instead to fullfill our expectations.

It's not charming, but one way to solve this problem is to generate invalid GeoJSON. We simply pass lines over the longitude +180/-180.

Install

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

Usage

import mapCoordinates from 'geojson-web-map-coordinates'

const geometry = mapCoordinates([[-170, -10], [175, 0], [-170, 10]])
console.log(JSON.stringify(geometry))
// {"type":"LineString","coordinates":[...,[-185,0],...]}
1.1.0

3 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago