geojsonfile
v1.0.0
Published
read and write a feature collection in a json file
Downloads
4
Readme
geojsonfile
Manage a Feature Collection in a JSON file.
Install
npm install --save geojsonfile
Usage
var turf = require('@turf/helpers')
var geojsonfile = require('geojsonfile')
var filepath = path.join(__dirname, 'data.json')
var file = geojsonfile(filepath)
file.put('coolgeojsonpoint', turf.point([-122, 32]), function (err) {
file.get('coolgeojsonpoint', function (err, data) {
console.log('data', data)
})
})
Alternate fs
module
Use an alternate fs
implementation like hyperdrive by passing it in as an option:
var turf = require('@turf/helpers')
var geojsonfile = require('geojsonfile')
var hyperdrive = require('hyperdrive')
var filepath = path.join(__dirname, 'data.json')
var drive = hyperdrive(require('random-access-memory'))
// Use the hyperdrive instance:
var file = geojsonfile(filepath, { fs: drive })
Contributing
Contributions are welcome! Please read the contributing guidelines first.
Conduct
It's important that this project contributes to a friendly, safe, and welcoming environment for all, particularly for folks that are historically underrepresented in technology. Read this project's code of conduct