Skip to content

Small Node.js util method with no dependencies to flip coordinates (lon/lat) in geojson documents.

License

Notifications You must be signed in to change notification settings

eivinhb/geojson-flip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

**/
    

About

Small Node.js util method with no dependencies to flip coordinates (lon/lat) in geojson documents.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published