@mapbox/geojson-coords

0.0.2 • Public • Published

geojson-coords

Extract coordinates from GeoJSON.

install

npm install --save @mapbox/geojson-coords

api

coords(geojson)

Given any valid GeoJSON object, return a single array of coordinates that it contains. Handles any root object, collapses multidimensional coordinate arrays and expands point coordinate arrays.

example

var geojsonCoords = require('@mapbox/geojson-coords');

geojsonCoords({
    "type": "GeometryCollection",
    "geometries": [
        {
            "type": "Point",
            "coordinates": [100.0, 0.0]
        },
        {
            "type": "LineString",
            "coordinates": [ [101.0, 0.0], [102.0, 1.0] ]
        }
    ]
});
// returns [[100, 0], [101, 0], [102, 1]];

Package Sidebar

Install

npm i @mapbox/geojson-coords

Weekly Downloads

228,202

Version

0.0.2

License

ISC

Unpacked Size

5.89 kB

Total Files

8

Last publish

Collaborators

  • mbx-npm-ci-production
  • mbx-npm-ci-staging
  • mbx-npm-advanced-actions-production
  • mbx-npm-advanced-actions-staging
  • mbx-npm-09-production
  • mbx-npm-08-production
  • mbx-npm-07-production
  • mbx-npm-06-production
  • mbx-npm-05-production
  • mbx-npm-04-production
  • mbx-npm-03-production
  • mbx-npm-02-production
  • mbx-npm-01-production
  • mbx-npm-02-staging
  • mapbox-npm-01
  • mapbox-npm-02
  • mapbox-npm-07
  • mapbox-npm-03
  • mapbox-npm-04
  • mapbox-npm-09
  • mapbox-npm-05
  • mapbox-npm-06
  • mapbox-npm-08
  • mapbox-npm-advanced-actions
  • mapbox-npm-ci
  • mapbox-npm
  • mapbox-admin
  • mapbox-machine-user