nhd-load

0.0.6 • Public • Published

NHD Postgis Loader

Source Data

National Hydrography Dataset - USGS

Download

ftp://nhdftp.usgs.gov/DataSets/Staged/SubRegions/FileGDB/HighResolution

Install

$ npm install nhd-load

Testing

Download the test filegdb, unzip it, and place it in ./test/fixtures directory

Test Filegdb

ftp://nhdftp.usgs.gov/DataSets/Staged/SubRegions/FileGDB/HighResolution/NHDH1401_931v220.zip

To run the tests

$ npm test

API

nhd.loadFilegdb

var nhd = require('nhd-load');
var nhdFilegdb = __dirname + './filegdbs/NHDData.gdb' // Path to filegdb;
 
var dbOptions = {
  dbname: 'test',
  user: 'postgres',
  password: 'password',
  host: 'localhost',
  port: '5432'
};
 
nhd.loadFilegdb(nhdFilegdb, dbOptions, function(err, result) {
  if (err) {
    // handle err
  }
 
  // Console Output = "finished"
  console.log(result);
});
 

nhd.dropSchema

var nhd = require('nhd-load');
 
var dbOptions = {
  dbname: 'test',
  user: 'postgres',
  password: 'password',
  host: 'localhost',
  port: '5432'
};
 
nhd.dropSchema(nhdFilegdb, dbOptions, function(err, result) {
  if (err) {
    // handle err
  }
 
  console.log(result);
});
 

CLI

loadFilegdb

$ nhd-load loadFilegdb --dbname=nhdtest --port=5432 --host=localhost --user=postgres --password=password filegdbs/NHDData.gdb
 
nhd-load help
 
Usage:
 nhd-load loadFilegdb <src> <options>
 nhd-load dropSchema <options>
 
Example:
// Load NHD data
  $ nhd-load loadFilegdb --dbname=nhdtest --port=5432 --host=localhost --user=postgres --password=password filegdbs/NHDData.gdb
 
// Drop the transformed data and tables from the pg database
  $ nhd-load dropSchema --dbname=nhdtest --port=5432 --host=localhost --user=postgres --password=password filegdbs/NHDData.gdb
 
Options:
  --format=[destination database]  Default: PostgreSQL
  --dbname=[string]
  --user=[string]
  --password=[string]
  --port=[number] Default: 5432
  --timeout=[number] Default: 300000 ms

Contact

Andy B

Package Sidebar

Install

npm i nhd-load

Weekly Downloads

0

Version

0.0.6

License

MIT

Last publish

Collaborators

  • apburnes