npm.io
1.4.4 • Published 4 years ago

geojson-scanner

Licence
ISC
Version
1.4.4
Deps
0
Size
22 kB
Vulns
0
Weekly
0

Geojson-Scanner

Library that has utilities to examine and extract info of the GeoJson structures, such as Polygon, Point, LineString and many others.

Getting Started

Install GeoJson-Scanner with npm:

npm i geojson-scanner

Import GeoJson-Scanner in your file:

const GeoJsonScanner = require('geojson-scanner')

Then you have access to all methods, let's validate if this object is a valid GeoJson Polygon:

const GeoJsonScanner = require('geojson-scanner')

const polygon = {
    type: "Polygon",
    coordinates: [
        [
            [
              -43.06640625,
              44.213709909702054
            ],
            [
              -49.92187499999999,
              37.16031654673677
            ],
            [
              -31.81640625,
              38.41055825094609
            ],
            [
              -43.06640625,
              44.213709909702054
            ]
          ]
        ]
    }

console.log(GeoJsonScanner.isValidPolygon(polygon)) // Logs true

Keywords