Is it possible to save data directly into an existing PostGIS database from QGIS without having to first save it as a shapefile? I know about the SPIT plugin but that requires a shapefile. I want to know if is there a way to skip the save-to-shapefile-use-SPIT/shapefile-loader-to-import-to-Postgis process after an analysis in QGIS.

Edit: Example: Load road layer from PostGIS to QGIS. Calculate shortest path using road graph plugin and export as temporary (temp) layer. Right click on temp layer, select save as... the save as options include the general vector type files (shapefile,GeoJSON) and at the bottom of the list is an option to save as a spatiallite database. This, unfortunately, only creates a new spatiallite database with only the one shortest path road layer (no postgis option). What I would like to know is, is it possible to save a temp file directly into an existing PostGIS database?

  • What kind of input file do you have? If you start from scratch, it would be best to create a new PostGIS table and edit the PostGIS layer directly. DB Manager or PostGIS manager ... one of them works with drag-and-drop from the layer list or browser I think.
    – underdark
    Sep 7, 2013 at 17:11
  • I am using Postgis data and should have specified that I wanted to save the data to an existing postgis database.
    – PyMapr
    Sep 8, 2013 at 8:22
  • 1
    Is there a specific reason why you do routing with road graph plugin instead of pgRouting directly in the database? That would allow for a simpler workflow.
    – underdark
    Sep 8, 2013 at 8:25
  • Underdark, I agree it would be much easier to do in Postgis but the users (farmers in this case) are not familiar with sql and databases, therefore the QGIS approach with a more point and click GUI.
    – PyMapr
    Sep 8, 2013 at 8:41

2 Answers 2


If you have your data in a QGIS layer, and a separate layer from a postgis table visible, you can always

  • zoom to the extent of the QGIS layer
  • select all features with a rectangle
  • make the postgis layer editable
  • Edit -> Insert the objects
  • Save the postgis layer
  • Toggle Edit mode of the postgis table off

It is not possible, since postgis does not accept Z coordinate, qgis when saying copy gets XYZ coordinates and will not be able to accept the table in postgis. I have NOT been able to copy objects from qgis to postgis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.