qgis/pyqgis-api-docs-builder

layer.materialize() does not copy all features

Closed this issue · 1 comments

layer.materialize() seems to only copy the features that conform to the fields definitions.

E.g. layer has an attribute QgsField('name', QVariant.String, len=6). A feature that would have a name of 7 or more chars would not get copied via materialize.

The way I see it, there are two possibilities:

  1. since creating and updating non conforming features is possible, also allow materializing them
  2. do not allow creating/updating non conforming features in the first place

The second one seems better, as QGIS seems to crash in some cases when non conforming features exist...

Of course, there is also a way to do that with warnings: when a feature is created/updated/left out of materialize/,,, issue a warning.

Also see this.

DelazJ commented

do not allow creating/updating non conforming features in the first place

@strokovnjaka I assume you are using ESRI Shapefile and if i'm not wrong this is allowed by that format, and QGIS (actually GDAL) just complies with that. Don't ask me why.
Back to the issue, you should report at https://github.com/qgis/QGIS/issues. This repo is mainly for documenting the API not creating/consolidating it.
Thanks for your understanding.