This guide explains how project members access the PostGIS database from their preferred tools. It is written for reproducibility and publication, so all connection examples use placeholders rather than live infrastructure values.
| Parameter | Value Pattern |
|---|---|
| Host | |
| Port | 5432 |
| Database | |
| User | |
| Password | stored locally in .env or provided out of band |
| SSL | according to your private network setup |
Before connecting:
Typical daily tasks:
For a focused setup walkthrough, see DBeaver_Setup_Guide.md.
This method is suitable for small queries during development, but it is less convenient than DBeaver for schema exploration.
Create a local .env file:
Copy-Item .env.example .env
Minimal .env structure:
POSTGIS_HOST=<database-hostname>
POSTGIS_PORT=5432
POSTGIS_DB=<database-name>
POSTGIS_USER=<database-user>
POSTGIS_PASSWORD=<database-password>
DATABASE_URL=postgresql://<database-user>:<url-encoded-password>@<database-hostname>:5432/<database-name>
Read data from PostGIS:
import os
import geopandas as gpd
from dotenv import load_dotenv
from sqlalchemy import create_engine
load_dotenv()
engine = create_engine(os.getenv("DATABASE_URL"))
trees = gpd.read_postgis(
"SELECT * FROM bgcki.trees_inventory",
engine,
geom_col="geom",
)
Write data to PostGIS:
import os
import geopandas as gpd
from dotenv import load_dotenv
from sqlalchemy import create_engine
load_dotenv()
engine = create_engine(os.getenv("DATABASE_URL"))
result_gdf = gpd.read_file("data/derived/example.gpkg")
result_gdf.to_postgis(
name="example_table",
con=engine,
schema="analysis",
if_exists="replace",
index=False,
)
For publication workflows, export maps or GeoPackages from QGIS rather than editing the operational database interactively.
If pgAdmin is enabled in docker-compose.yml, open it through the internal service URL configured for your environment. Keep that URL in internal operational notes rather than public-facing documentation.
Use pgAdmin only when: