PostGIS

SQL

  • How to create a PostGIS database

    CREATE DATABASE database_name;
    \c database_name
    CREATE EXTENSION postgis;
    
  • How to check the PostGIS extension is installed

    SELECT postgis_full_version();
    
  • How to add the PostGIS raster extension

    CREATE EXTENSION postgis_raster;
    

SHapefiles

  • How to import Shapefiles into PostGIS

    shp2pgsql -s 4326 AREA.shp > AREA.sql
    
    psql -U DATABASE_USER -d DATABASE_NAME -f AREA.sql