So, I have local QGIS project file and hope to export all the layers and their styles altogether into PostgreSQL.

My overall aim is to access project file directly from DB. I know QGIS has function to save the entire project into PostgreSQL, but it only saves the state of workspace, so it still accesses local shapefiles if not export them into DB.

Is there any possible solution?

  • latest versions allow qgis projects to be saved in postgresql/postgis bostongis.com/blog/index.php?/archives/… – DPSSpatial Mar 18 at 19:25
  • ogr2ogr would be my tool of choice for bulk-insertions of shapefiles, via bash for-loop. However, you can simply drag'n'drop layers within the QGIS Browser and set the layer data sources in your project. – geozelot Mar 18 at 20:43
  • @DPSSpatial thanks for your reply. I know it can store project file, but it is actual the state of the workspace, when load the project file from postgre, it still call my local shapefiles. it there any easier way to store layer and especially layer style to DB? – abbey Mar 18 at 21:12
  • @geozelot thank you, is there any way to bulk store layer styles? – abbey Mar 18 at 21:13
  • @abbey I'm not aware of any built-in bulk upload, however (in recent versions of QGIS) you can save and manage layer styles in PostgreSQL/SQLite/GeoPackage if the data source is in the same DB. A quick and more 'bulky' workaround would be to create a project with all layers styled as needed and use it as template? – geozelot Mar 18 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.