My question is about the calculator in the QGIS graphical modeler. I explain my problem issue first:

I want to build a modeler that creates buffers around layers and makes a selection on a second layer if the polygons are inside the buffers. You see a picture of that modeler here under.

enter image description here

In fact, my modeler is working well until I add a calculator. My input layers are in WGS84 projection, that's why the buffer is measured in decimal degrees. I want to add a calculator that divides the distance by 111 (approximately) so that I can seize the distance in kilometers in the input field.

The calculator is a modeler function that specially exists for that issue of modifying numerical values (entered by the user or generated by some other algorithm). The documentation only said to use the modelers value as a variable. So, I tried differents syntaxes:

a / 111
Distance1 / 111
Distance1 / 111
"Distance1" / 111

etc. But I always get the same error message:

enter image description here

According to some discussions, it means that the assignment of the variable is not understood what seems logical to me. Can anybody share experiences of the use of the Calculator in the graphical modeler with me?

The documentation about longer function series in the modeler is not so good, that's why I didn't find any tutorial that uses the calculator.

How should I define my variables well? I am using QGIS Essen as I changed my computer recently, can this be a source of problems and I should go back to QGIS Vienna stable version?

1 Answer 1


Buffering features in wgs84 does not work with distances calculated in meters. You first have to reproject each layer to a projected crs suitable for your area. In the modeler this is possible with

enter image description here

  • Thanks, I tried that but it means that I have to reproject the layers that iI want to buffer and the one I want to do a selection on later. The data are situated in Egypt where we couldn't find any interesting projection that would fit and having meters as defaut unit. By the way, it's not a response to the question about the calculator that simply doesn't seem to work! Finally, I put the shapes in a PostGis database from where I have the same geoprocessing tools by writing SQL and I can include calculations!
    – Aenne Ramm
    Jun 29, 2016 at 9:14
  • 3
    the calculator fails because he can't compute meters and degrees. That's why you should reproject first. But if you have a sollution with postgis, it's good.
    – PieterB
    Jun 30, 2016 at 6:50
  • 1
    Try to reproject in WGS 84 / Pseudo-Mercator EPSG 3857. It's a derivative WGS84 who use the meter as a unit. It's mainly used for web mapping, it works everywhere and is easy to use with the metric system.
    – Tim C.
    Feb 19, 2019 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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