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": {} 
            }
        ]
    }
 
**/
    

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    24
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    24

Package Sidebar

Install

npm i geojson-flip

Weekly Downloads

24

Version

1.0.0

License

ISC

Last publish

Collaborators

  • eivinhb