How to perform volume calculation in QGIS

EDIT 07/12/12

Ok, meanwhile I came to another problem I want to discuss. I just tried around with the volume calculation with some layers and came to a point where I receive the following error. Screenshot:

I did some research and discovered this explanation: http://blog.webforefront.com/archives/2011/02/python_ascii_co.html The problem is, that I have absolutely no Idea about python programming. So my question is: Does anyone know how to solve this described error problem?

Note: I left the older questions below in order to see the process I made.

I m currently trying to make a volume calculation in QGIS. I realised, that using GRASS or Sextante is the right choice to do this. But since there are barely useful tutorials, that go into depht nor any other guides or hints that may help in this context, I want to seek help here. So I want to ask these questions:

1)I want to calculate the volume of a specific map area. So I discovered the algorithm "r.volume."

1.1.)How does it work exactly?The Help text in that menue is not very useful for me as a Grass beginner.

1.2) Why do I need raster layers for this and no vector layers?

1.3) What certain criteria do these rasters have to fulfill?

1.4) I added a screenshot. What exactly are these "clumps" and what rasters have to be chosen in the drop down list?

1.5) Can I have an accurate example of how to perform such an r.volume algorithm?I d be thankful for any detailed help/ raster files to test this.

2)I learned, that GRASS (in QGIS) was integrated into the Sextante Plugin for QGIS.

2.1) Does this mean I can only use Sextante and still have all the functions of Grassgis?I d welcome that because I always had trouble with importing data into Grassgis. Sextante doesn t (obiously) require this.(?)

2.2) A strengh of gvSIG is Sextante, so I read; Is the Sextante Plugin for QGIS equal to gvSIG Sextante concerning performance/ possibilities?

thanks a lot, Shepherdjo

EDIT:07/11/12 8.08am:

I know this is not easy to answer but it would be great too, if you can help me out with the other questions (2.1/2.2).

-
Thank you for the hint but I did not quite understand that summary, since I need clear examples of how to perform it.. – Shepherdjo Jul 11 '12 at 5:56
The manual contains an example - it is one command only to be done. – markusN Jul 11 '12 at 14:42
BTW: The Python bug should be reported to the Sextante bugtracker. – markusN Aug 4 '12 at 20:58
You don't need to know how to solve it. SEXTANTE for QGIS is a work in progress and there is a commitment to fix what does not work, so just report the issue here hub.qgis.org/projects/sextante/issues and the developer will take care of it. – Giovanni Manghi Aug 11 '12 at 15:21

Update; I tried the volume calculation again and came to the conclusion that it can be done with grass, since sextante produces this weird error (see above). Set the Mapset and convert your raster layer(it has to be a file that countains the elevation data(dem)) to a grass file. Make sure, all projections match, otherwise an error will occur during conversion. First run r.clump, that will produce another raster(clump-map).Convert this one into grass too. In r.volume you ll now use your both rasters and run the method. Worked good for me. Hope this helps. Jo

-
Good and relevant list of questions. Thank you for that. – CARTOS Oct 6 '14 at 20:09

UnicodeDecodeErrors can be cryptic, but I think you're fortunate in having a situation that's easy to debug. Look at the statement

``````text = unicode(a)
``````

The unicode function uses the ascii codec by default, so that is equivalent to

``````text = unicode(a, 'ascii')
``````

Check to see whether the value of a in your case is not an ascii encoded string. Is it UTF-8 or some other? If it is, you'll need to pass the proper encoding to the unicode method. Here's an example of what would happen if your data was a UTF-8 encoded string and you didn't account for that:

``````>>> a = "Σταυρόπολις"
>>> a
'\xce\xa3\xcf\x84\xce\xb1\xcf\x85\xcf\x81\xe1\xbd\xb9\xcf\x80\xce\xbf\xce\xbb\xce\xb9\xcf\x82'
>>> unicode(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 0: ordinal not in range(128)
>>> unicode(a, 'utf-8')
u'\u03a3\u03c4\u03b1\u03c5\u03c1\u1f79\u03c0\u03bf\u03bb\u03b9\u03c2'
``````

The Sextante plugin code needs to get the proper encoding for your data instead of assuming it's ascii.

-
Thanks for your answer. I do understand the sense behind it but I don t know what I am supposed to do now according to this. All I have is a raster file, that I want to use. I have no Idea WHERE to change WHAT exaclty, do I have to open a file or smth. like that? Can you be more precise here? Thanks alot. – Shepherdjo Jul 13 '12 at 6:15
No, I can't be more precise. – sgillies Jul 13 '12 at 14:24
Really...I have no Idea about python and this code fragments..Please can you give me a hint, I really need to get this working.. – Shepherdjo Jul 14 '12 at 7:50