[GRASS-user] patching vectors - some are not patched

Markus Metz markus.metz.giswork at gmail.com
Mon Nov 19 07:59:55 PST 2018


On Mon, Nov 19, 2018 at 4:52 PM Ken Mankoff <mankoff at gmail.com> wrote:
>
> Hi Martin,
>
> On 2018-11-19 at 16:32 +0100, Markus Metz <markus.metz.giswork at gmail.com>
wrote:
> >> On 2018-11-19 at 08:26 +0100, Ken Mankoff <mankoff at gmail.com> wrote:
> >>
> >> r.mapcalc "basin = if(basin, ${count}, null())" --o
> >> r.to.vect -v input=basin output=b type=area --o
> >> v.patch -a input=b output=basin --o
> >> v.clean in=basin out=basin_clean0 tool=break,rmdupl --o
> >> v.clean in=basin_clean0 out=basin_clean1 tool=snap,break,rmdupl --o
> >
> > you can also clean the patched vector with
> >
> > v.clean tool=bpol,rmdupl,break,rmdupl -c
> >
> > it could be a bit faster
>
> If found it faster and easier to not work in vector space. I now write
out the raster with 'r.out.xyz raster=basin >> basin.txt" (I'm actually
doing this with GNU parallel with one basin and one file per CPU core).
Then I can read concat and read in everything as a raster. Finally,
converting the single raster to a vector seems to work better than
accumulating all the individual vectors.

looking at your aim: get basins for all outlets, you could also use
1. r.stream.extract with stream_vector as output
outlets have category value 2 in layer 2
2. extract the outlets with v.extract lyer=2 type=point cats=2
3. use the outlets as input for r.stream.basins

Markus M

>
> Thanks,
>
>   -k.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20181119/fe8483c1/attachment-0001.html>


More information about the grass-user mailing list