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:
- Add all tables into QGIS, perform Joins on geom and non geom tables, select features in map and save selection as spatiallite DB
- Create a spatial view in POSTGIS, add view to QGIS, select features in map and save selection as spatiallite DB