Feature request #4281

More user friendly handling of geometryless tables and layers loaded by a query with no matching features

Added by Alister Hood about 6 years ago. Updated 6 months ago.

Status:In Progress
Pull Request or Patch supplied:No Resolution:
Easy fix?:No


When adding a WFS layer with the option "only request features overlapping the current view extent", if there are no features in the current map extent, the layer is added, and looks like the top layer in the attached part of a screenshot.
On the symbology tab of the layer properties, the top row of the old symbology options is shown (legend type, single symbol, transparency, new symbology button). If you click the new symbology button, the dialog switches to the labels tab. The symbology tab behaviour is the same with geometryless tables (e.g. try with the layers stored in ~/.qgis/qgis.db).
I think the same things can occur with other layer types which can be loaded with a query (postgis, spatialite...)

1) Maybe it would be possible when loading a layer with a query, to detect if there are no features, and provide a message telling the user that there are none. (But a user might want to load an empty layer and add some features, so if the layer is writable, I guess the user should have a choice to load it...)

2) It would probably be less confusing if the symbology tab was not shown for a geometryless table.

untitled.PNG (2.5 KB) Alister Hood, 09/12/2011 08:19 PM


#1 Updated by Anita Graser about 6 years ago

  • Target version set to Version 2.0.0

#2 Updated by Alister Hood almost 6 years ago

2) It would probably be less confusing if the symbology tab was not shown for a geometryless table.

Also, the CRS and extent related features should ideally be disabled (greyed-out or something) or hidden for geometry-free tables.
e.g. in the layer right click menu: "Set layer CRS", "Set project CRS from layer", and on the layer properties General tab, "Specify CRS", and on the Metadata tab "Extents" and "Layer Spatial Reference System".

#3 Updated by Pirmin Kalberer about 5 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have

#4 Updated by Médéric RIBREUX almost 2 years ago

  • % Done changed from 0 to 50
  • Status changed from Open to In Progress

Hello, bug triage...

I think there is a difference between geometryless tables and an empty layers in QGIS now.

For geometryless tables, QGIS now disable the Style tab which is good (try with a CSV or a simple SQLite table) and answers to a part of your request. The CRS selection is still enabled and it should be disabled at all following this feature request.

When you add an empty table, QGIS tries to determine the geometry type and set a default style for this (Simple Fill for polygons). For WFS, the geometry type is detected from the request answer of the WFS Server. For PostGIS layers (even for views or queries), the geometry type is detected from metadata views. For Oracle, QGIS asks to the user what is the geometry type of the layer. For those empty layers, QGIS displays a Style tab and this coherent with the fact that this is a geometry table with no feature. In the recent versions of QGIS, an empty WFS layer is not detected as a geometryless table but an empty geometry table which is better that the situation you related.

So, to answer totally to this feature request we need to:

- Display a message when user opens an empty layer (with geometry column in it or not).
- Disable CRS selection for geometryless tables.

#5 Updated by Giovanni Manghi 6 months ago

  • Easy fix? set to No

Also available in: Atom PDF