I have a .shp file (downloaded by googling USGS maps + census data + tiger ), loaded the file in QGIS. It contain various road lines in a city. In the attribute table it is showing only few properties ObjectId, LinerID, FullName, MTFCC. I am trying to retrieve the other information like length of road, width etc. But I not aware where I can get that information in QGIS.


To illustrate what @user35594 suggested:

enter image description here

| improve this answer | |
  • where can I see the default units/change units (from Miles to KM or Km to miles) – makot Sep 21 '16 at 18:03
  • You have no choice other than entering the formula yourself. For example, to get the length in miles, enter $length/1609.344. Make sure that your data is in a projected CRS with units being meters (not degrees). – wiltomap Sep 22 '16 at 6:44

If your crs is in a UTM projection, you can calculate the length of your line by using $length in the field calculator expression. You can't calculate the width of lines, only polygons, unless it is already stored in the attribute table.

| improve this answer | |
  • 1
    but I dont have length field in the attribute table. i have only ObjectId, LinerID, FullName, MTFCC properties. I am sure using any of this I cant calculate length. But when I select any road line and if I check its WKT I can see its starting latitude and longitude and ending latitude and longitude. Using this I can calculate the spatial distance between starting point and end point but not the length of road. correct me if I am wrong. – makot Sep 20 '16 at 20:56
  • 2
    @makot you can edit the table and add a field called length before using the calculate $length command >step 15 qgistutorials.com/en/docs/calculating_line_lengths.html – Mapperz Sep 20 '16 at 21:24
  • 1
    To possibly clear up confusion, the "Length" field you add will be empty. The process to fill it that @user35594 gave will calculate the length directly from the geometry of the data. This calculation looks at not just the start and end points as you saw in the WKT, but also any intermediate vertices. – Get Spatial Sep 21 '16 at 3:36

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.