stepankuzmin / turf-shift-longitude

Reads every point of every feature in a geometry, and if the longitude coordinate is < 0, adds 360 to it. The result would be a 0-360 version of the data to be plotted in a 180 centric map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

turf-shift-longitude

build status

turf.shift-longitude(layer)

Reads every point/vertex in every component of every feature in a geometry, and if the longitude coordinate is < 0, adds 360 to it. The result would be a 0-360 version of the data to be plotted in a 180 centric map.

Parameters

parameter type description
layer Object any GeoJSON object

Example

var shift = require('turf-shift-longitude');
var point = { type: 'Point', coordinates: [-175, 70] };
var shifted = shift(point);
//=shifted

Returns Object, layer shifted GeoJSON object

Installation

Requires nodejs.

$ npm install turf-shift-longitude

Tests

$ npm test

About

Reads every point of every feature in a geometry, and if the longitude coordinate is < 0, adds 360 to it. The result would be a 0-360 version of the data to be plotted in a 180 centric map


Languages

Language:JavaScript 100.0%