turf-to-features

1.0.0 • Public • Published

turf-to-features

converts arbitrary geojson into feature objects

turf.to-features(geojson)

Takes an arbitrary GeoJSON object and converts it to a Feature or FeatureCollection

Parameters

parameter type description
geojson Feature,Geometry,FeatureCollection,GeometryCollection geojson to convert

Example

var poly = {
  "type": "Polygon",
  "coordinates": [[
    [-122.801742, 45.48565],
    [-122.801742, 45.60491],
    [-122.584762, 45.60491],
    [-122.584762, 45.48565],
    [-122.801742, 45.48565]
  ]]
};

var feature = turf.toFeatures(poly);

// Feature is:
{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-122.801742, 45.48565],
      [-122.801742, 45.60491],
      [-122.584762, 45.60491],
      [-122.584762, 45.48565],
      [-122.801742, 45.48565]
    ]]
  }
};

Returns Feature,Collection,

Installation

Requires nodejs.

$ npm install turf-to-features

Tests

$ npm test

Package Sidebar

Install

npm i turf-to-features

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • tcql