2

I'd like to try and turn QGIS into a simple hiking planner. I have found and worked out how to import OS raster mapping at the correct scale and how to add freehand vector lines to the mapping, which is a start. I'd now like to take things a bit further and make QGIS do something more useful. I realise there are commercial products available that do a similar thing, but they cost money!

I have started to play around with extra attributes to the vector lines I am adding in my vector 'routes' layer, such as length in Km, length in miles etc. However, I'm not sure how to do this effectively.

The length of the line in Km is already encapsulated in each line in the (Derived) section of the id. I'd like to grab that and put it in its own, easier to view column. I'd also like to automatically have QGIS convert this to miles in another column.

Finally, if possible, I'd like QGIS to calculate and somehow display the length and bearing of each leg (ie the distance between each node), which I suspect might be trickier.

Is any of this possible?

ElendilTheTall
  • 881
  • 1
  • 11
  • 21
  • Perhaps you should have a look at Viking and QLandkarte GT, which are more designed for such use cases, and also free of cost. – AndreJ Aug 26 '13 at 12:38
  • Do either of those allow importing of raster data with tfw files for easy georeferencing? – ElendilTheTall Aug 26 '13 at 12:48
  • See this thread for handling the bearing problem: http://gis.stackexchange.com/questions/24260/how-to-add-direction-and-distance-to-attribute-table – nhopton Aug 26 '13 at 15:11
  • QLandkarteGT can. And even read Geotiffs already georeferenced by QGIS. And overlay with GPX files, Garmin vector maps, OSM tiles, show a degree grid, and so on. – AndreJ Aug 26 '13 at 15:12
  • Hmmm, QLandekarte doesn't like my OS TIFFS. It fails to load them. – ElendilTheTall Aug 26 '13 at 17:50

1 Answers1

1

You can get the length of a line into the attribute table with the field calculator.

Create a new field of type real, and add $length from the Geometry section. Being a calculator, you can add a scaling factor to get miles instead of metres in the same step.

To get the length of each line segment, you would have to break the line up at every vertex.

AndreJ
  • 76,698
  • 5
  • 86
  • 162
  • Just found it! And I have converted to miles with a simple expression. Is there anyway to have QGIS do this automatically when the line is drawn? Or failing that, have a 'macro' that populates the columns accordingly on demand? – ElendilTheTall Aug 26 '13 at 12:22
  • No. The bad thing is that if you move a vertex, the content of the attribute table remains unchanged. So not a good idea for automatic labelling. Just seen: The labelling engine behind the abc icon does provide labelling with the true and live $length, but thats independent from the attribute tables values. – AndreJ Aug 26 '13 at 12:24
  • 1
    Labeling using an expression is the way to go. – Nathan W Aug 26 '13 at 12:57