Assert that docker is properly installed.
Pull the latest 3DCityDB Image :
docker pull 3dcitydb/3dcitydb-pg:latest
Run the image on a chosen port (/!\ assert that this port is not already used by another program):
docker run --name citydb -p $YOURPORT:5432 -d -e POSTGRES_PASSWORD=$YOURPASSWORD -e SRID=$EPSGCODE 3dcitydb/3dcitydb-pg:latest
You can now use pgAdmin4 to connect to the 3DCityDB and check if its running (both db and user should be by default "postgres")
/!\ Do not use 'localhost' but use your local ip adress to point to the 3DCityDB
Fill the 3DCityDB using the 3DCityDB/impexp docker :
docker pull 3dcitydb/impexp:latest
docker run --rm --name impexp -v $PATH_TO_YOUR_REPO_HOLDING_YOUR_DATA:/data 3dcitydb/impexp:latest import -H $YOUR_LOCAL_IP -P $YOURPORT -d postgres -u postgres -p $YOURPASSWORD /data/$YOURFILE.gml
This note explains how to setup PostgreSQL to be able to create cityGML databases, for example in order to run py3dtilers.
This tuto is inspired by Fabrice Lainard's tutorial (in french).
Download and install a PostgreSQL version.
Run the installer and install PostgreSQL and all the additional components. You can keep the default installation parameters.
Once PostgreSQL installation is over, execute Stack Builder and install Postgis.
Install PostGIS
If your PostgreSQL password isn't set yet, launch pgAdmin4 to set it.
Note: To be able to use the psql
command in Windows shell, add the bin
folder path (for example C:\Program Files\PostgreSQL\10\bin) in PATH environmental variable. You can now use the psql -U postgres <...>
commands on Windows.
Warning: Java JDK version 11 or higher must installed and setted to continue.
Download and install 3DCityDB.
Launch the application pgAdmin4 and create a database.
Select your database and open the Query tool
.
Create postgis
and postgis_raster
extensions. Execute the query :
create extension postgis;
create extension postgis_raster;
And in the Query Editor :
In the 3DCityDB-Importer-Exporter
folder you've installed before, find the CONNECTION_DETAILS
script (in \3DCityDB-Importer-Exporter\3dcitydb\postgresql\ShellScripts, then choose Windows or Unix). Edit CONNECTION_DETAILS
with the details of your database and run CREATE_DB
. The script will ask you a SRID (for example 3946 if your data is in EPSG:3946) and your PostgreSQL password.
Your database can now receive cityGML data.
Launch the 3DCityDB-Importer-Exporter
script (from the root of your 3DCityDB-Importer-Exporter installation.
In Database, add the details of your database.
Then in Import, browse for a .gml file then click on 'Import' below.
You can import as much cityGML files as you want in your database. Your database is now ready.