Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mborne/node-ogr2pg
[DATA] Helper to load spatial files with multiple formats into postgis
https://github.com/mborne/node-ogr2pg
geojson loader nodejs postgis shapefile
Last synced: 26 days ago
JSON representation
[DATA] Helper to load spatial files with multiple formats into postgis
- Host: GitHub
- URL: https://github.com/mborne/node-ogr2pg
- Owner: mborne
- License: mit
- Created: 2018-10-19T06:09:39.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-15T03:30:53.000Z (almost 3 years ago)
- Last Synced: 2024-04-29T08:22:48.122Z (8 months ago)
- Topics: geojson, loader, nodejs, postgis, shapefile
- Language: JavaScript
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-ogr2pg
[![Node.js CI](https://github.com/mborne/node-ogr2pg/actions/workflows/node.js.yml/badge.svg)](https://github.com/mborne/node-ogr2pg/actions/workflows/node.js.yml) [![Coverage Status](https://coveralls.io/repos/github/mborne/node-ogr2pg/badge.svg?branch=master)](https://coveralls.io/github/mborne/node-ogr2pg?branch=master)
## Description
Provides an helper to invoke [ogr2ogr](https://www.gdal.org/ogr2ogr.html) and [psql](https://www.postgresql.org/docs/current/static/app-psql.html) to import spatial file into [PostGIS](https://postgis.net/).
## Usage
```js
const ogr2pg = require('@mborne/ogr2pg');const result = await ogr2pg({
'inputPath': 'place.shp',
'tableName': 'place'
});console.log(result.status);
console.log(result.message);
console.log(result.command);
```## Options
| Name | Required? | Description | Default |
| ---------------- | :-------: | ---------------------------------------------------------------- | -------- |
| `inputPath` | YES | Input file path (.shp, .geojson, etc.) | |
| `encoding` | NO | Input encoding (UTF-8, LATIN1,...) | `UTF-8` |
| `tableName` | YES | Output table name | |
| `createTable` | NO | Automatically create table (drop table if exists) | `false` |
| `schemaName` | NO | Output schema name | `public` |
| `createSchema` | NO | Automatically create schema if not exists | `false` |
| `promoteToMulti` | NO | Promote geometry to multi (ex : MultiPolygon instead of Polygon) | `false` |
| `skipFailures` | NO | skip failures when importing data | `false` |## License
[MIT](LICENSE)