Bug report #21086

Can't add a virtual field or update a existing field of a WFS layer using the field calculator

Added by Bo Thomsen over 1 year ago. Updated over 1 year ago.

Status:Closed
Priority:Normal
Assignee:Alessandro Pasotti
Category:Web Services clients/WFS
Affected QGIS version:3.5(master) Regression?:No
Operating System:Any Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28904

Description

If you try to add a virtual field to a WFS based layer using the field calculator it will fail and show "NULL" regardless what expression you use in the created field.

Further, it's not possible to set the type or field length for the virtual field because the relevant combo boxes in the dialog are disabled.

Lastly, you can't update a existing field using the field calculator (The wfs can however by edited manually in the attribute dialog)

Associated revisions

Revision 57d32939
Added by Alessandro Pasotti over 1 year ago

Field calculator: provide a list of default field types

in case the provider does not (WFS is one of them).

Rationale: consider that there is not such
a thing like a list of supported types for WFS
and parsing the particular describeFeatureType
for the layer would restrict the types to only
those actually existing in the layer, but
we are dealing with virtual fields here (because
WFS has no column add capabilities) so
let's give the users a minimal set of useful
types to play with.

Fixes #21086

History

#1 Updated by Alessandro Pasotti over 1 year ago

  • Category changed from Field calculator to Web Services clients/WFS

Changing category to WFS because I assume that all of this is working correctly with the other provider, or not?

#2 Updated by Bo Thomsen over 1 year ago

Yes, I exported one of the wfs-datasources to a shapefile and retried the experiment. It worked as epected with the shapefile based data.

#3 Updated by Alessandro Pasotti over 1 year ago

  • Assignee deleted (Bo Thomsen)

#4 Updated by Alessandro Pasotti over 1 year ago

  • Assignee set to Alessandro Pasotti

#5 Updated by Alessandro Pasotti over 1 year ago

  • Resolution set to worksforme
  • Status changed from Open to Feedback

Next time please file separate tickets for separate issues, even if in this particular case my first answer is the same.

1 - If you try to add a virtual field to a WFS based layer using the field calculator it will fail and show "NULL" regardless what expression you use in the created field.

I cannot reproduce with current master on Linux (but I doubt that the OS makes any difference).

2 - Further, it's not possible to set the type or field length for the virtual field because the relevant combo boxes in the dialog are disabled.

I cannot reproduce with current master on Linux (but I doubt that the OS makes any difference).

3 - Lastly, you can't update a existing field using the field calculator (The wfs can however by edited manually in the attribute dialog)

I cannot reproduce with current master on Linux (but I doubt that the OS makes any difference).

Cna you please test current master?

#6 Updated by Alessandro Pasotti over 1 year ago

  • Resolution deleted (worksforme)

Sorry, I need to update my results:

I can reproduce 1 and 2 but not 3, working on it.

#7 Updated by Alessandro Pasotti over 1 year ago

  • Status changed from Feedback to In Progress
  • Affected QGIS version changed from 3.4.4 to 3.5(master)
  • Operating System changed from windows 10 to Any
  • Pull Request or Patch supplied changed from No to Yes

#8 Updated by Alessandro Pasotti over 1 year ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF