stacker-of-worlds
Stack GeoJSON spanning multiple worlds onto the One True World
Last updated 4 years ago by davidtheclark .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install stacker-of-worlds 
SYNC missed versions from official npm registry.

stacker-of-worlds

Stack GeoJSON spanning multiple worlds onto the One True World of CRS84 — that is, with all longitudes contained between -180 and +180.

By different "worlds" I mean different 360 degree segments of an infinite longitudinal range: -180 to +180, 180 to 540, 540 to 900, -540 to -180, -900 to -540, etc.

How it works

Accepts a GeoJSON Feature or FeatureCollection and returns a new Feature or FeatureCollection representing the same information but with the following transformations to ensure coordinates fall within real longitudes (applied to the sole Feature or else to every Feature in the FeatureCollection):

  • If the Feature exists completely inside +/-180, leave it as it is.
  • If the Feature exists completely outside +/-180, translate its coordinates over to the One True World.
  • If the Feature spans any number of datelines in any number of "worlds", split it at the datelines to create one geometry for each world, translate each geometry's coordinates to the One True World, then combine all the translated coordinates into a Multi* Feature.

Usage

CLI

Usage
  stacker-of-worlds <input> <output> <options>

  If no input is provided, stdin is used.
  If no output is provided, stdout is used.

Options
  --pretty, -p    Write JSON within line breaks and indentation.

Example
  stacker-of-worlds ./foo.geojson ./stacked/stacked-foo.geojson --pretty

Node

stackerOfWords.stack(geojsonObject)

That's an object as opposed to a string. Returns the stacked GeoJSON (also as an object).

const stackerOfWords = require('stacker-of-worlds');
const myWorldSpanningFeature = require('my-world-spanning-feature.geojson');
const realWorldFeature = stackerOfWords.stack(myWorldSpanningFeature);

Current Tags

  • 0.2.0                                ...           latest (4 years ago)

2 Versions

  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |