Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving to PostGIS? #39

Open
larsgrobe opened this issue Aug 7, 2021 · 1 comment
Open

Moving to PostGIS? #39

larsgrobe opened this issue Aug 7, 2021 · 1 comment

Comments

@larsgrobe
Copy link

Dear all,
first, thanks to the authors for contributing this plugin which makes it very convenient to work with 3D city data in QGIS! I am currently investigating options to share 3D models through PostGIS, and CityJSON appears to provide exactly the level of detail we will need. However, to have access to the 3D data (just as vector and raster data in 2D), I would need to store the models in my PostGIS database. Simply dragging the QGIS-Layer did not work since my PostGIS-Tables lack the z row. Would it be possible to support PostGIS as a storage for the CityJSON-models loaded into QGIS, or is this already possible and I just need to add a column to my tables? I could not find anything about this in the documentation.
Best, Lars.

@liberostelios
Copy link
Contributor

Thanks for your kind words! Glad to see that you found the plugin useful.

It's definitely possible to store 3D data in PostGIS, but making it work can be a bit tricky. I am not sure if a simple copy-paste would work out of the box. Maybe that would work, as soon as your layer's geometry definition in PostGIS is defined specifically for 3D? But I am not sure if I would trust QGIS in the process.

My suggestion is that you export from QGIS using the GDL toolbox. You'll have to make an intermediate file, though:

  1. Export the imported CityJSON layer to a file by right-clicking on the layer and selecting Export->Save features as.... I would suggest that you choose a Geopackage or GeoJSON. Make sure that under the you set the Geometry type to Polygon and that you have the Include z-dimension checkbox checked.
  2. From the toolbox select GDAL->Vector miscellaneous->Export to PostgreSQL (available connection). Select your connection and, as input, the file that you just exported. Also, make sure that you set the Vector dimensions to 3.

When I tested this, I ended up with 3d geometries in PostGIS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants