How can I buffer a line in QGIS using one attribute for the left side of the line and one attribute for the right side of the line? I am trying to buffer a river with its bank width, which is different on the right and left side.
Defining a line's side is rather straight forward on an orientable surface, which a 2D plane in a GIS is. If you define a start point and an end point for a line, you can unambiguously define "left" and "right" sides. This is the case even if the line crosses itself.
From a more practical standpoint, simple workflow for creating a one-sided buffer includes a standard buffer, a difference operation, and then a clipping operation. Here's an example.
Start by creating a polygon that includes, or precisely overlaps, your line. In order for the buffer to be on the right side of your line the inside of the polygon should be on the left. Note that if your line crosses itself then this won't work as desired, and you may need to draw the polygon such that it doesn't cross itself or your line. Apply the buffer operation to this polygon. Using the fTools plugin go to Geoprocessing Tools > Buffer.
Using the difference operation, Geoprocessing Tools > Difference, with the buffer as the input layer and the original polygon as the difference layer, cut out the inside. Now you have a right-side buffer.
All that remains is to clip the "extra" part of the polygon. Geoprocessing Tools > Clip.
This is a very interesting question, which I believe is non trivial to solve. I came across a script for ArcMap which provides a very nicely documented solution spanning 500 lines of VB code. However I am not aware of an equivalent script or module in QGIS.
One of the key considerations in an asymmetric buffer will be the direction of flow of the line, so that you can define a left and right side. In the case of rivers this should be straightforward to calculate if you have an accompanying DEM.
It may be possible to build a qgis script around the logic of this script, but that would require an extensive amount of work.
1In ArcMap this is very easy to achieve. In the tool dialog you have the parameter
Side Typewhich can be either left or right. And you have the parameter
Field. So scripting this tool allows you to use different values for both. I just recently did this (see my question here) Sep 14, 2012 at 7:18