Skip to content

Latest commit

 

History

History
103 lines (59 loc) · 4.85 KB

PostgreSQL_for_cityGML.md

File metadata and controls

103 lines (59 loc) · 4.85 KB

Install 3DCityDB with Docker

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

Install 3DCityDB with CL

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).

1. Download PostgreSQL/PostGIS

Download and install a PostgreSQL version.

Run the installer and install PostgreSQL and all the additional components. You can keep the default installation parameters.

image

Once PostgreSQL installation is over, execute Stack Builder and install Postgis.

image

image

Install PostGIS

image

If your PostgreSQL password isn't set yet, launch pgAdmin4 to set it.

image

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.

2. Create a 3DCityDB database

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.

image

Select your database and open the Query tool.

image

Create postgis and postgis_raster extensions. Execute the query :

create extension postgis;
create extension postgis_raster;

And in the Query Editor :

image

image

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.

image

image

image

Your database can now receive cityGML data.

3. Import cityGML in database

Launch the 3DCityDB-Importer-Exporter script (from the root of your 3DCityDB-Importer-Exporter installation.

In Database, add the details of your database.

image

Then in Import, browse for a .gml file then click on 'Import' below.

image

You can import as much cityGML files as you want in your database. Your database is now ready.