1

The preference/option/map tools window allows you to modify the units of measurement. my QGIS v 3.22 is set to meters. I made a measurement. Then I finally wanted to do this calculation in kilometers without doing any division. So I configured QGIS in kilometers. The new calculation gives an identical result.

I don't understand where the problem comes from. Does someone have an idea?

enter image description here enter image description here enter image description here enter image description here

2
  • 1
    The unit QGIS uses for computing this result comes from the ESPG unit. If you set a projection with km as unit the output of length will be km and for area will be km^2. If you uses a lat/long projection, the output of length will be in grades (not recommended at all). As J.R says, it's better work with sum($length) / 1000 will give you the km value in a meter projected layer.
    – aldo_tapia
    Commented Oct 2, 2023 at 13:38
  • 2
    @aldo_tapia the "$length" function should respect the unit setting (The length calculated by this function respects both the current project's ellipsoid setting and distance unit settings). The "length" function does not (the units of the returned length will match the units for the SRS)
    – J.R
    Commented Oct 2, 2023 at 14:18

1 Answer 1

2

It seem you are setting the unit as km in the general option setting (in this setting the measurement unit are in the "Map Tools" tab ; "Outils cartographique" for you). This setting will act on all new project but wont change the setting in already existing project.

To set the measurement setting in existing project you need to open the project properties (Project > Properties… or click on the EPSG indicator at the bottom right of the main QGIS window) and go to the "General" tab, there you can set the project to km.

(As a side note using sum($length) / 1000 will give you the same result without needing to change the setting)

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.