[Qgis-developer] Thoughts about multi-type tables in QGIS

Nyall Dawson nyall.dawson at gmail.com
Mon Apr 6 03:08:16 PDT 2015


On 3 April 2015 at 01:41, Bo Victor Thomsen <bo.victor.thomsen at gmail.com> wrote:
> As an old MapInfo user/developer my opion is: Don't do it. It has always
> been a problem in MapInfo and it will be a problem in QGIS - if implemented.

Count me in as another MapInfo graduate who has seen the mess which
multi-type tables cause and isn't in favour of this approach.

That said, I'm very interested in this conversation as it touches on
some thoughts/work I've been tackling lately. I think there's some big
improvements we can make as to how QGIS handles geometries in a layer.

I often work with layers which have a mix of null/not null geometries.
It's important for me to be able to easily edit tables of this form,
including adding new records with no geometry to the table. This isn't
currently (easily) achievable in QGIS. You can add geometries to an
existing record, remove the geometry from a record, add a new record
with a geometry but you can't add a record without a geometry.

I've been thinking of modifying the attribute table to show geometry
columns. This would be done via a new QgsGeometryWidget widget, which
would display the geometry type ((multi)point/line/polygon) and a
button with an attached menu for clear geometry/copy as wkt/copy as
geojson/paste geometry options. Actually, this is already written -
see https://github.com/nyalldawson/QGIS/commit/fc7c79fb322bf3f6d681bb3a013efea941517767
. This could be extended with the suggestions from
http://hub.qgis.org/issues/10283 and the functionality from the
plain-geometry-editor plugin.

Then, we could add a new "Add record" button to the attribute table
dialog for adding a new (empty) row, which would initially contain no
geometry. That fixes the first part of my issues with geometry
columns.

On 4 April 2015 at 07:59, Régis Haubourg
<regis.haubourg at eau-adour-garonne.fr> wrote:

> The only thing annoying me currently is that QGIS "sees" all geometry
> columns when this slow down attribute view a lot. In 1.8 or before (can't
> remember), QGIS did not see them and that was fine to me, and avoided to
> type SQL in DBmanager to add correctly the data in QGIS.

This is my second big issue with geometry handling. I think the
solution would be to use the proposed QgsGeometryWidget as the default
editor for geometry columns in the dialog. This would avoid the issue
of massive WKT strings choking the table and grinding QGIS to a halt.
However, this relies on implementation of the suggestion from Martin
here:
http://osgeo-org.1560.x6.nabble.com/Multiple-geometry-columns-per-layer-tp5019573p5019895.html

If this suggestion was implemented, then it also opens the possibility
of having data defined geometry overrides for symbology/labeling. Eg,
a table could have an additional line geometry column for label
placement overrides. If this line geometry is not null then it would
be used as the geometry for label placement, otherwise it would fall
back to the actual feature's geometry. Think along the lines of
manually curved labels for selected polygons...

Nyall


More information about the Qgis-developer mailing list