Skip to main content

PostGIS Commands

Project description

PostGIS commands.

Description

  • Wraps cli operations into a single interface

    • psql, shp2pgsql, \copy, ogr2ogr, etc.

  • Import/export to desired format

  • Tested on MacOS

Usage

$ pgtk
Usage: pgtk [OPTIONS] COMMAND [ARGS]...

  PostGIS Command Line Tool

Options:
  -h, --host TEXT    hostname
  -p, --port TEXT    port number
  -d, --dbname TEXT  database
  -u, --user TEXT    user
  -s, --schema TEXT  database schema
  -c, --crs TEXT     EPSG code
  --help             Show this message and exit.

Commands:
  export  Export PostGIS data
  import  Import data to PostgreSQL
  layers  Layer commands

Viewing data:

$ pgtk -h suffolk.geoserver.org -d boundary_data -s public_works layers list
--- public_works.boundary_data ---
 * zip_codes
 * suffolk_boundary
 * fire_districts
 * landmark_historic_districts
 * waterfront
 * zongin_district
 * boston_neighborhoods
 * land_use
 * planning_districts
 * water
 * parcels
 * downtown
 * airports
 * harbor_islands
$
$ pgtk -h suffolk.geoserver.org -d boundary_data -s public_works layers preview boston_neighborhoods
--- preview boston_neighborhoods ---
gid        name    acres    neighborho    sqmiles    shapestare    shapestlen  geom
  1  Roslindale  1605.57            15       2.51   6.99383e+07       53563.9  01060000...

Export PostGIS data:

$ pgtk -h suffolk.geoserver.org -d boundary_data -s public_works \
> export -o ~/Downloads --driver csv boston_neighborhoods suffolk_boundary
--- export csv ---
>> boston_neighborhoods
COPY 26
>> suffolk_boundary
COPY 1
$
$ head -5 ~/Downloads/boston_neighborhoods.csv | column -t -s,
gid  name           acres                 neighborho  sqmiles  shapestare                shapestlen             coordinate_y      coordinate_x
1    Roslindale     1605.568237499999896  15          2.510    69938272.925570487976074  53563.912597056623781  42.2825239371116  -71.1266625924454
2    Jamaica Plain  2519.245393770000192  11          3.940    109737890.75433960556983  56349.937161410227418  42.3077695033488  -71.1150969429541
3    Bay Village    26.539839160000000    33          0.040    1156070.765868443064392   4650.635493295902052   42.3491032446921  -71.0690319987556
4    Roxbury        2108.469071760000134  16          3.290    91844545.974815726280212  49488.800484731051256  42.3185185721262  -71.0866432257429

Install

$ pip install postgis-toolkit
  • Python 3.7+

  • Requires postgis tools installed on your computer - shp2pgsql & pgsql should be on your path.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postgis-toolkit-0.0.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

postgis_toolkit-0.0.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file postgis-toolkit-0.0.1.tar.gz.

File metadata

  • Download URL: postgis-toolkit-0.0.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for postgis-toolkit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 acb4be24f9826281a403da17598067c7140fadf479787791e3acdd6a34074a64
MD5 f59326eb02907f310d5a311b7d4f0914
BLAKE2b-256 c7e1cc5de4abd45fdf76b8b719c35b7875461689c5a61a3010658142b8b633cc

See more details on using hashes here.

File details

Details for the file postgis_toolkit-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: postgis_toolkit-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for postgis_toolkit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d62dad7663e348eb3a17331c8a69d35bc9a5ccd6cf4053273c14bb56c160d67b
MD5 f9f44aef1c6e44c95d9d14a281279208
BLAKE2b-256 16079dae71a6f48c49feca1922aa2b72c503e6a9a63b40399524f7c0aaf53c36

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page