Skip to content

This module fetches a geojson file from an http link and reduces the file size using Turf methods.

Notifications You must be signed in to change notification settings

VerteDinde/fetch-geojson-turf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fetch-simple-geojson-p

This module fetches a geojson file from an http link and tries to reduce the file size by:

  • Removing unnecessary digits via turf.truncate
  • Simplifying geometry via turf.simplify()
  • Keeping only specified property values

This module is promisified; a version for callbacks can be found under fetch-simple-geojson.

Usage

var fs = require('fs')
var simplify = require('fetch-simple-geojson-p')

var data = 'https://opendata.arcgis.com/datasets/cd78700c5c5c4a338090ce4c7b996f03_3.geojson'
var options = {
  tolerance: 0.0001,
  highQuality: true,
  keepProperties: ['NAME']
}

simplify(data, options, function (err, result) {
  if (err) return console.error(err)
  fs.writeFile('output.json', JSON.stringify(result), function (err) {
    if (err) return console.error(err)
    console.log('SUCCESS!!')
  })
})

About

This module fetches a geojson file from an http link and reduces the file size using Turf methods.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published