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.
2 Answers
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.
-
1but 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.– makotCommented Sep 20, 2016 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 ♦Commented Sep 20, 2016 at 21:24
-
1To 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. Commented Sep 21, 2016 at 3:36
2
-
where can I see the default units/change units (from Miles to KM or Km to miles)– makotCommented Sep 21, 2016 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).– wiltomapCommented Sep 22, 2016 at 6:44