Skip to content

AppGeo/cartodb-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cartodb-uploader

streaming upload to cartodb, arguemnts are

  • credentials object with user and api members
  • filename, in the format of desired_table_name.fileExt
  • callback (optional) to be called when the table ends up being created

returns a writable stream that accepts the file, acceptable file extensions are accourding to cartodb

  • csv
  • tab
  • shp
  • kml
  • kmz
  • xls
  • xlsx
  • geojson
  • gpx
  • osm
  • bz2
  • ods

also has a geojson method which just takes a destination table instead of a filename and is a writable object stream taking geojson features

var cartodbUploader = require('cartodb-uploader');

var featureStream = getFeatureStreamSomehow();
featureStream.pipe(cartodbUploader.geojson({
  user: 'username',
  key: 'apikey'
}, 'destination_table_name', function (err, resp) {
  // optional callback when done
}));

var binaryCSVstream = fs.createReadStream('./something.csv')

featureStream.pipe(cartodbUploader({
  user: 'username',
  key: 'apikey'
}, 'something.csv', function (err, resp) {
  // optional callback when done
}));

CLI API

npm install -g cartodb-uploader

Upload a file named foo.geojson

cartodb -f foo.geojson -a apikey -u username

or you can set the apikey as an enviromental variable

export CARTODB_API_KEY=apikey
export CARTODB_USER_NAME=uername
cartodb foo.geojson

or give it a different name

cartodb TEMP_BLAH -n foo.geojson

the name can be combined with stdin

curl some/url | cartodb -n foo.geojson

About

streaming uploader to cartodb

Resources

License

Stars

Watchers

Forks

Packages

No packages published