README
GeoJSON Writer
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 pathgeojson
Features GeoJSON FeatureCollectionoptions
[Options](default {}) Optionsoptions.properties
[Array<string>] List of properties to include in GeoJSONoptions.precision
[number] Reduce coordinate precision (optional, default6
)options.boolean
[boolean] Drop Z coordinates (optional, defaultfalse
)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, default6
)
writeFeature
Write Feature
Parameters
stream
feature
index
array