Skip to content

A simple CLI program to create geopackage archive from PostgreSQL

License

Notifications You must be signed in to change notification settings

ben-lc/export-geopackage

Repository files navigation

export-geopackage

A basic CLI tool used to export spatial data to geopackage.

Supported data source

  • PostgreSQL / Postgis (basic indeed)

Run

From jar (windows / linux / mac)

  1. Install java 17+

  2. Download jar file

  3. Open a terminal and run java -jar gpkg.jar -h

Usage

See man page

JSON configuration file

Table 1. JSON properties
property type description required

datasource

object

property type description required

host

string

database server host name

true

port

string

database server port

true

database

string

database name

true

schema

string

database schema

true

user

string

database user

true

password

string

database password

true

source database configuration

true

contents

Array<object>

property type description required

source

object (see below)

source data properties

true

geopackage

object (see below)

geopackage data properties

true

configuration of data to export

true

Table 2. contents.source properties
property type description required

tableName

string

table containing data to export

true

columns

Array<string>

list of columns to export (must contain a column with spatial data)

true

filter

string

filter

false

maxFeatures

number

maximum number of features to export

false

Table 3. contents.geopackage properties
property type description required

identifier

string

identifier of geopackage content

false

description

string

description of geopackage content

false

crs

string

crs of spatial data, if not set source crs will be used, otherwise it will be reprojected to defined one

false

Sample json
{
  "datasource": {
    "host": "that.host",
    "port": 5432,
    "database": "that_db",
    "schema": "that_schema",
    "user": "mkeal",
    "password": "azerty"
  },
  "contents": [
    {
      "source": {
        "tableName": "that_table",
        "columns": ["height", "geom"],
        "filter": "height > 10",
        "maxFeatures": 50
      },
      "geopackage": {
        "identifier": "stuff",
        "crs": "EPSG:4326",
        "description": "so much stuff"
      }
    },
    {
      "source": {
        "tableName": "that_other_table",
        "columns": ["size", "name","geom"],
        "filter": "size = 42"
      },
      "geopackage": {
        "identifier": "another stuff",
        "crs": "EPSG:2154",
        "description": "so much other stuff"
      }
    }
  ]
}

About

A simple CLI program to create geopackage archive from PostgreSQL

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages