1

Is it possible to carry out a batch field calculator process in QGIS across multiple layers resulting in a decimal number? I have manage to do it and get an integer but not a decimal. There are only options for an integer, float, date and string in the field type drop down.

I am trying to calculate the area of roughly 3900 layers so don't want to have to calculate it individually.

Batch calculator resulting in an integer

4
  • 2
    The field you are trying to write to is integer type? Add the code you used
    – BERA
    Feb 7 '20 at 10:15
  • I'm new to QGIS and even newer to coding. I didn't use and code for the answer only the field calculator function this is what the log results in:{'FIELD_LENGTH': 10, 'FIELD_NAME': 'Interc km2', 'FIELD_PRECISION': 3, 'FIELD_TYPE': 1, 'FORMULA': '$Area', 'INPUT': 'Intersect SSP3BINOMIAL_Civettictis civetta', 'NEW_FIELD': True, 'OUTPUT': <QgsProcessingOutputLayerDefinition {'sink':U:/Batch Intersects/C-H/AreaIntersect SSP3BINOMIAL_Civettictis civetta.csv, 'createOptions': {}}>}
    – user137547
    Feb 7 '20 at 10:41
  • Your field is integer/whole number type. You need decimal type
    – BERA
    Feb 7 '20 at 10:42
  • there isn't an option for decimal type
    – user137547
    Feb 7 '20 at 10:44
1

In the filed type you should have Float.

enter image description here

Or something which work as a float type in your storage file. I see that there are different options, probaly based on the storage format: I have seen Float, decimal number (real), Decimal number (numeric)` and so on.

This is what I got on a .shp files:

enter image description here

Or Postgresql:

enter image description here

1
  • Yes using the float worked thank you!
    – user137547
    Feb 7 '20 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.