0.0.3 • Published 9 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 coreutilsdynamosm-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.pbfdynamosm-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
9 years ago
0.0.2
9 years ago
0.0.1-enzo-scanno-56ff58b
9 years ago
0.0.1-enzo-scanno-256f2dc
9 years ago
0.0.1
9 years ago
0.0.0
10 years ago