Wednesday, 6 July 2016

qgis - How to create/add features without geometry?


I have a simple SpatiaLite geodb loaded in QGIS with one table. There is a POINT geometry field and some alphanumeric fields.


In some cases I can record data about a specific site, but the coordinates are not available at this time and will be retrieved and recorded later.


How do I add features to this layer without adding their geometries?



Answer



If the database schema allows so, you can add geometry-less features in QGIS if the layer can be added as a non-geometric layer: SpatiaLite and PostGIS support this functionality if you enable the "show tables without geometry" option in their respective dialogs. Among the "tables without geometry" there will be also a "duplicate" (so to say) of the tables with a geometry field.



Adding the same table as spatial and non-spatial layer


You can add both items for a single table and get two layers for one table.


The non-spatial layer will allow you to add new features (via the + button in the attributes table) where the geom field can be NULL (I repeat, if the database schema allows so):


Adding a new feature with a NULL geometry


Shapefiles don't allow this kind of work-flow as far as I know. It may not be orthodox, but it works and it can be useful in certain cases.


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...