gj2pg

0.4.1 • Public • Published

gj2pg Build Status

Streams GeoJSON data to a PostGIS configured PostgreSQL database.

Note: Casts all geometry using ST_Multi, let me know if this is a problem

To get started, install gj2pg, via npm install --save gj2pg.

Usage

var GJ2PG = require('gj2pg'),
  config = require('./config'),
  gj2pg;
 
gj2pg = new GJ2PG({
  config: config,
  inputFilePath: 'data.json',
  tableName: 'countries',
  propertiesMap: ['ObjID:id', 'Country_Name:name'],
  geometryColumnName: 'geom'
});
 
gj2pg.go();

The config format is JSON in the following format:

{
  "user": "test",
  "password": "password",
  "database": "myDb"
}

Command Line

npm install -g gj2pg
gj2pg -f data.json -t providers -m 'OBJECTID:id, ProvName:name' -g geom

See help, via gj2pg -h for more information and available options.

Todo

  • Figure out a more clear way to map properties/geometry property
  • Up for suggestions..

Special Thanks

To Calvin Metcalf, who wrote most of the original code.

Package Sidebar

Install

npm i gj2pg

Weekly Downloads

2

Version

0.4.1

License

MIT

Last publish

Collaborators

  • knownasilya