4

I read a lot of posts concerning that subject, nevertheless I cannot solve to problem of getting $length in the field calculator in meters rather than in decimal degress in QGIS.

The CRS of original shapefile is WGS84 (EPSG:4326). I reprojected the shape to World Euidistance Cylindrical (Sphere) (EPSG:3786). I did the same in project settings (with on the fly transformation enabled).

However I am still getting the length of the polylines in decimal degrees. Any ideas?

4
  • If your shapefile has been correctly reprojected, and matches the project CRS, then on-the-fly projection shouldn't be necessary.
    – L_Holcombe
    Commented Dec 5, 2012 at 7:00
  • 1
    We can't help you unless we know what software are you using? Commented Dec 5, 2012 at 7:01
  • It's QGIS I am guessing because QGIS has the $length variable.
    – Nathan W
    Commented Dec 5, 2012 at 7:13
  • 1
    Yes, it is QGIS
    – gfuellerer
    Commented Dec 5, 2012 at 8:13

1 Answer 1

6

I don't think you really reprojected the Shapefile to EPSG:3786.

To really reproject the data, use "Save as ..." and select EPSG:3786 (or better even a fitting UTM CRS as Andre mentioned) as a target CRS. You can calculate length in meters in this new file.

On-the-fly reprojection in project properties ONLY affects how data is rendered. It does NOT affect calculations and geometry operations.

2
  • 3
    Furthermore, EPSG 3786 is not really suitable for measuring. It defines all meridians of longitude with equal distance. In reality, the further you come to the poles, they get nearer to each other. You better take a projected CRS like UTM for real measuring.
    – AndreJ
    Commented Dec 5, 2012 at 8:41
  • To measure distance without "saving as..." you can use length(transform($geometry, layer_property(@layer_name, 'crs'), 'EPSG:32632')). Instead of EPSG:32632 use the UTM Zone fitting for your area.
    – MrXsquared
    Commented Nov 20, 2018 at 16:38

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.