0.0.3 • Published 7 years ago
dynamosm-importer v0.0.3
dynamosm-importer
Stream some sql queries to a postgres database. Plus some tools for converting geojsons into sql on their way into the database
cli
On Max OS X, requires greadlink
, which you can install by running
brew install coreutils
dynamosm-importer
Given a url pointing at an osm.pbf, download the file, convert to geojson using minjur, and import to postgres.
export PGDB=my_database
dynamosm-importer "insert into my_table values ({geojson}) http://url/to/some.osm.pbf
dynamosm-importStream
export PGDB=my_database
cat line-delimited-geojsons.file | dynamosm-importStream "insert into my_table values ({geojson})"
js
querify
A transform stream that
- turns geojson strings in sql json literals
- will format a query for you, replacing {geojson}
- escapes any pesky single quotes that would otherwise ruin your sqlized json
DynamosmImporter
A writable stream that accepts sql queries, writing them to a postgres database in transactions/batches.
example
var split = require('split');
var querify = require('..').querify;
var DynamosmImporter('..');
var options = {
batchSize: 200,
dbname: my_database,
dbuser: my_user
}
fs.createReadStream('somefilewithlinedelimitedGeoJSONs')
.pipe(split())
.pipe(querify('insert into some_table values ({geojson})'))
.pipe(DynamosmImporter(options))
.on('finish', function() {
console.log('all inserts completed');
});
0.0.3
7 years ago
0.0.2
8 years ago
0.0.1-enzo-scanno-56ff58b
8 years ago
0.0.1-enzo-scanno-256f2dc
8 years ago
0.0.1
8 years ago
0.0.0
8 years ago