I have a postgis(v2.1.3)/postgresql(v9.3) database with geometry (geom1, geom2, etc.) and attribute (attr1, attr2, attr3, etc.) tables. The attribute tables are linked to the geometry tables using foreign keys. I use QGIS to view all these tables. I want to select features in QGIS (either using a rectangle, polygone or manual select) from the map and then create a mini-database using only these selected features (from the geometry tables) and the relevant records from the attribute tables. Is this possible? Ideally I want the mini-database to be in spatialite/sqlite but I can find a way to convert from postgis to spatialite using ogr2ogr.


Sounds like you may have two options:

  1. Add all tables into QGIS, perform Joins on geom and non geom tables, select features in map and save selection as spatiallite DB


  1. Create a spatial view in POSTGIS, add view to QGIS, select features in map and save selection as spatiallite DB
  • Thanks for the 2 options, they work but at the cost of losing the structure of my database. Also, I have multiple cases of cardinality 1:N, eg one geometry feature has multiple entries in the attr1, attr2, etc. tables). Trying to recreate the structure of the database is going to be a pain! – lavaman Nov 10 '14 at 17:23

Your Answer

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

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