Friday, 10 April 2015

python - How to write a (memory) layer from QGIS to PostGIS?


I am looking for an "elegant" solution to write, from a python script, a layer from qgis and into a new table of a PostGIS database. I thougth that this might be solved by QgsWriteVectorLayer, but I could not find any hint that this is supported. I only found the solution that this can be done e.g. with Qtsql, but then one has to:




  1. analyse the layer (field names, field datatypes, srid, ... )

  2. create the table and

  3. fill the table with date.


Question: Does pygis offers a "simple" solution to write a complete layer directly into a new PostGIS table?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...