npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

geojson-flip

1.0.0 • Public • Published

Build Status Coverage Status

GeoJson-flip

I had to make this little util out of necessity. It only flips 2d geojson.

Geojson-spec says that `The order of elements must follow x, y, z order (easting, northing, altitude for coordinates in a projected coordinate reference system, or longitude, latitude, altitude for coordinates in a geographic coordinate reference system). Map websites like geojson.io and github gist (*.geojson) uses this order of coordinates. MongoDB also uses lon lat.

But applications differ as this web page show and should you encounter an issue with coordinates on the wrong, then flip em.

Usage

var flip = require("geojson-flip").flip;
 
console.log(
    flip({
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": [125.6, 10.1]
                },
                "properties": {}
            }
        ]
    }))
    
/**
{
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": [10.1, 125.6]
                },
                "properties": {} 
            }
        ]
    }
 
**/
    

Keywords

install

npm i geojson-flip

Downloadsweekly downloads

159

version

1.0.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability