geojson-writer

0.3.6 • Public • Published

GeoJSON Writer

Build Status Circle CI Coverage Status npm version Known Vulnerabilities MIT licensed

Reads & writes GeoJSON files based on RFC 7946 GeoJSON.

Install

$ npm install --save geojson-writer

Quickstart

import {writer, reader} from 'geojson-writer'
 
const data = reader('places.geojson')
// <--Data processing-->
writer('places-processed.geojson', data)

Features

  • Reads GeoJSON files
  • Writes GeoJSON files
  • Compact indentation, 1 line per feature (smallest file size possible)
  • Limits coordinates decimals to a maximum of 6
  • Does not include CRS

API

writer

Writes GeoJSON file

Parameters

  • path string File path
  • geojson Features GeoJSON FeatureCollection
  • options [Options](default {}) Options
    • options.properties [Array<string>] List of properties to include in GeoJSON
    • options.precision [number] Reduce coordinate precision (optional, default 6)
    • options.boolean [boolean] Drop Z coordinates (optional, default false)
    • options.properties [Array<(string | number)>] Only include the following properties

Returns void

removeEmptyProperties

Remove Empty values

Parameters

  • feature Feature

reader

Reads GeoJSON file

Parameters

  • path string File must be a GeoJSON FeatureCollection

Returns Features GeoJSON FeatureCollection

toFix

Reduce coordinate precision

Parameters

  • array
  • precision (optional, default 6)

writeFeature

Write Feature

Parameters

  • stream
  • feature
  • index
  • array

Package Sidebar

Install

npm i geojson-writer

Weekly Downloads

4

Version

0.3.6

License

MIT

Last publish

Collaborators

  • deniscarriere