geojson-is-valid

v0.0.5
Simple function to determine if geojson objects are valid
geojson valid hint lint validator test validation

Geojson is valid

NPM

Media Suite

Build Status

This module provides a very light wrapper around the work the file folks at mapbox have been doing with geojsonhint to provide simple boolean checks on geojson objects

Usage

npm install --save geojson-is-valid
var isValid = require('geojson-is-valid')

var validGeojsonFeature = {
  type: 'Feature',
  id: 'way/4243736',
  properties: {
    highway: 'trunk'
  },
  geometry: {
    type: 'LineString',
    coordinates: [
      [
        172.5498622,
        -43.4932694
      ],
      [
        172.5498622,
        -43.4932694
      ]
    ]
  }
}

var validGeojsonCollection = {
  type: 'FeatureCollection',
  features: [ validFeature ]
}

isValid(validGeojsonFeature) //true
isValid(validGeojsonCollection) //true
isValid('something else') //false
npm i geojson-is-valid

Metadata

  • MIT
  • Whatever
  • Richard Walker
  • released 11/20/2017

Downloads

Maintainers