[GRASS-user] Problems with r.terraflow and r.thin

Dear list members,

I am currently working on the generation of watersheds for a small european
country;-)
Due to the amount of data (4089x2860, res=20) I have to use r.terraflow
instead of r.watershed.
In my opinion the outcoming watersheds of r.terraflow are not really
compact, rather fuzzy at the borders. See attached file.
Could that be the problem for my results in r.thin, which are completly
unuseable? See attached file.

Whats going here?
Any ideas to solve this problem?

cheers,
Christian
(See attached file: r_thin.png)(See attached file:
watershed_r_terraflow.png)

(attachments)

r_thin.png
watershed_r_terraflow.png

christian.braun wrote:

I am currently working on the generation of watersheds for a small
european country;-)
Due to the amount of data (4089x2860, res=20) I have to use
r.terraflow instead of r.watershed.
In my opinion the outcoming watersheds of r.terraflow are not really
compact, rather fuzzy at the borders. See attached file.

..

Whats going here?

maybe Helena and Laura's comments help:
http://article.gmane.org/gmane.comp.gis.grass.devel/16319
http://article.gmane.org/gmane.comp.gis.grass.devel/1442

searching the mailing lists turns up some more, such as:
http://thread.gmane.org/gmane.comp.gis.grass.user/16202/focus=16228

Could that be the problem for my results in r.thin, which are
completly unuseable? See attached file.

garbage in, garbage out of course. Make sure all your inputs are healthy
before undertaking the next step... I'm not familiar with your dataset
so no idea how good/bad r.thin did, or even what you are thinning.
(stream network?)

Any ideas to solve this problem?

Let GRASS 6.2.2's r.watershed run for a week or three until you get a
result. Try without the -m flag first, only use that if you get out-of-
memory errors. Eventaully it gets done, it just takes a while.

tip - set shell priority low before starting a long-running process:
GRASS> renice +19 -p $$
GRASS> r.watershed ...

You can make grass shell always start up at a lower priority by adding
the renice to ~/.grass.bashrc

Hamish

Hi,

ok I had to learn that you can't compare the results of r.terraflow and
r.watershed regarding the watershed generation. I think r.watershed gives me
the better results, so I will try to use this module.
But I still have the problem with r.thin to get rid of the linear features
describing watersheds. The pics I had attached are, of course, the results
of thining my watersheds of r.terraflow. First pic result watersheds of
r.terraflow, second pic the thining result.

Any Ideas here?

Thanks in advance,
Christian

-----Ursprüngliche Nachricht-----
Von: Hamish [mailto:hamish_nospam@yahoo.com]
Gesendet: Mittwoch, 15. August 2007 08:02
An: christian.braun@tudor.lu
Cc: grassuser@grass.itc.it
Betreff: Re: [GRASS-user] Problems with r.terraflow and r.thin

christian.braun wrote:

I am currently working on the generation of watersheds for a small
european country;-) Due to the amount of data (4089x2860, res=20) I
have to use r.terraflow instead of r.watershed.
In my opinion the outcoming watersheds of r.terraflow are not really
compact, rather fuzzy at the borders. See attached file.

..

Whats going here?

maybe Helena and Laura's comments help:
http://article.gmane.org/gmane.comp.gis.grass.devel/16319
http://article.gmane.org/gmane.comp.gis.grass.devel/1442

searching the mailing lists turns up some more, such as:
http://thread.gmane.org/gmane.comp.gis.grass.user/16202/focus=16228

Could that be the problem for my results in r.thin, which are
completly unuseable? See attached file.

garbage in, garbage out of course. Make sure all your inputs are healthy
before undertaking the next step... I'm not familiar with your dataset so no
idea how good/bad r.thin did, or even what you are thinning.
(stream network?)

Any ideas to solve this problem?

Let GRASS 6.2.2's r.watershed run for a week or three until you get a
result. Try without the -m flag first, only use that if you get out-of-
memory errors. Eventaully it gets done, it just takes a while.

tip - set shell priority low before starting a long-running process:
GRASS> renice +19 -p $$
GRASS> r.watershed ...

You can make grass shell always start up at a lower priority by adding the
renice to ~/.grass.bashrc

Hamish

Christian Braun wrote:

Hi,

ok I had to learn that you can't compare the results of r.terraflow and
r.watershed regarding the watershed generation. I think r.watershed gives me
the better results, so I will try to use this module.
But I still have the problem with r.thin to get rid of the linear features
describing watersheds. The pics I had attached are, of course, the results
of thining my watersheds of r.terraflow. First pic result watersheds of
r.terraflow, second pic the thining result.

Christian

Forgive me if I got you wrong, but are you by any chance running r.thin
on a raster map made of adjacent watershed polygons? Please note that
r.thin is supposed to be used for thinning raster *line* features. The
manual reads: "Thins non-zero cells that denote linear features in a
raster map layer".

If you need watershed borders as raster lines, you can use r.to.vect to
extract watersheds as vector polygons (areas) and rasterise their
boundaries with v.to.rast type=line (if this doesn't work, convert
boundaries into lines first with v.type, and run v.to.rast type=line on
this).

Maciek

Thanks for your answer, I missunderstood the meaning of r.thin.
But how can I get rather compact and smooth polygons representing watersheds
without any slivers or attached/appended fractals of the size of one raster
cell?
Is it possible to solve such a problem with v.clean or something like a
"raster smoothing" with r.neighbour?

Christian

-----Original Message-----
From: Maciej Sieczka [mailto:tutey@o2.pl]
Sent: Tuesday, August 21, 2007 9:21 PM
To: Christian Braun
Cc: 'Hamish'; grassuser@grass.itc.it
Subject: Re: AW: [GRASS-user] Problems with r.terraflow and r.thin

Christian Braun wrote:
> Hi,
>
> ok I had to learn that you can't compare the results of r.terraflow
> and r.watershed regarding the watershed generation. I think
> r.watershed gives me the better results, so I will try to
use this module.
> But I still have the problem with r.thin to get rid of the linear
> features describing watersheds. The pics I had attached are, of
> course, the results of thining my watersheds of
r.terraflow. First pic
> result watersheds of r.terraflow, second pic the thining result.

Christian

Forgive me if I got you wrong, but are you by any chance
running r.thin on a raster map made of adjacent watershed
polygons? Please note that r.thin is supposed to be used for
thinning raster *line* features. The manual reads: "Thins
non-zero cells that denote linear features in a raster map layer".

If you need watershed borders as raster lines, you can use
r.to.vect to extract watersheds as vector polygons (areas)
and rasterise their boundaries with v.to.rast type=line (if
this doesn't work, convert boundaries into lines first with
v.type, and run v.to.rast type=line on this).

Maciek

Christian Braun wrote:

Thanks for your answer, I missunderstood the meaning of r.thin. But
how can I get rather compact and smooth polygons representing
watersheds without any slivers or attached/appended fractals of the
size of one raster cell? Is it possible to solve such a problem with
v.clean or something like a "raster smoothing" with r.neighbour?

The v.generalize module, not yet in GRASS CVS, might be the tool. Look
at the man page [1]. You can fetch it from the AddOns SVN repository
[2] as a tarball and build from source. Sorry I can't provide more
detailed info. There are Folks on the GRASS list who can be of more
help in this regard.

[1]https://grasssvn.itc.it/grasssvn/grassaddons/trunk/grassaddons/v.generalize/description.html
[2]https://grasssvn.itc.it/grasssvn/grassaddons/trunk/grassaddons/

Maciek