1

I wanted to use the QGIS function 'Sum Line Length' to compute the sum of the road lengths in each grid cell in Nigeria. My roads data is from here: https://data.humdata.org/dataset/nigeria-roads My grid net is the PRIO Grid, hence 0.5 x 0.5 degree grid cells.

When I first used the function mentioned above all the data was in the "standard" geographical CRS EPSG:4326 - WGS 84. So the units were degrees. But since I need meters for better interpretation in my (spatial) regression, I exported the data to a projected CBS (EPSG:3786 - World Equidistant Cylindrical (Sphere)) and reran the function. Before when everything was in degrees, the column 'length' had actual values/numbers. But when I did it in the other CRS every cell which should have had values, has 'nan'.

I already tried different road data and different CRSs, nothing helped.

Although a similar question has been asked (QGIS "Sum Line Lengths" return 'nan.'), I don't see the solution.

(using QGIS 3.12.2)

0

It seems the tool works with UTM projection, and it does not work with EPSG:3786 - World Equidistant Cylindrical (Sphere). I used the latter projection, and I got the same results as yours with nan in length column. However, I tested (EPSG:32632 - WGS 84 / UTM zone 32N), and I the length was calculated properly.

Here is the results:

enter image description here

  • Thanks for the reply and your effort! Exactly thats the same result I got. Weird. – Anton von Poblozki Oct 1 '20 at 8:51
  • I tried it in an older version of QGIS (3.4.6) and it strangely allowed me to calculate the sum lengths in an CBS like EPSG:3786 - World Equidistant Cylindrical (Sphere) without the nan values. However I compared them with the other ones (that were calculated in the degree CBS) and they are identical. Could it be that the function 'Sum Line Lengths' automatically transforms the values into meters? – Anton von Poblozki Oct 1 '20 at 8:55
  • I am not sure, but it seems there is a bug in the tool. The best thing to do is to report a bug to the QGIS developer team: github.com/qgis/QGIS-Website/issues. – ahmadhanb Oct 1 '20 at 9:00

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.