[GRASS-user] derive points outlet from r.stream.extract

Huidae Cho grass4u at gmail.com
Wed Apr 29 16:18:54 PDT 2020


Giuseppe,

r.stream.extract does not link a table to layer 2, but layer 2 is there.
You can display outlets in GUI. Select layer=2 and cat=2 in d.vect.
[image: image.png]

Now, you want to extract the outlets.

v.extract input=extract_output layer=2 cat=2 output=outlets1

The outlets are still in layer 2 in the outlets1 map and they all have the
same cat (2).
v.category map=outlets1 option=report

Change the layer from 2 to 1.
v.category input=outlets1 layer=2,1 option=chlayer output=outlets2

Delete all cats (2) because they're just the same.(useless).
v.category input=outlets2 option=del cat=-1 output=outlets3

Add unique cats.
v.category input=outlets3 option=add output=final_outlets

Let's see.
v.report map=final_outlets option=coor

How do you link these points in final_outlets back to the original
extract_output? Now, you need to add a table to final_outlets.
v.db.addtable map=final_outlets column='src_cat int'

v.what.vect map=final_outlets col=src_cat query_map=extract_output
query_column=cat

Check
v.report map=final_outlets option=coor

Hope this helps.

Best,
Huidae


On Mon, Apr 27, 2020 at 6:25 AM Markus Neteler <neteler at osgeo.org> wrote:

> Hi Giuseppe,
>
> Could you post a reproducible example with North Carolina samle data?
> (being tight on time it would help)
>
> Best
> Markus
>
> On Thu, Apr 23, 2020 at 8:53 PM Giuseppe Amatulli
> <giuseppe.amatulli at gmail.com> wrote:
> >
> > Hi,
> > I'm trying to extract the outlet location from the
> > r.stream.extract stream_vector=stream  attribute.
> > In particular the manual for r.stream.extract reports:
> >
> > "In layer 2, categories are identical to type_code in layer 1 with
> additional category 2 = outlet for outlet points."
> >
> > I want to be able to extract only the points of layer 2 where category =
> 2.
> > However when I run
> >
> > v.db.connect  -p   map=stream
> > Vector map <stream> is connected by:
> > layer <1/stream> table <stream> in database
> </tmp/grass7-ga254-12721/tmploc/PERMANENT/sqlite/sqlite.db> through driver
> <sqlite> with key <cat>
> >
> > I can see only layer 1 (which does not contain category 2).
> >
> > Is there a way to connect to layer 2?
> > How I can be sure that also layer 2 has been created and is not missing?
> > Thanks
> > Giuseppe
> >
> > GRASS 7.6.0
> (tmploc):/gpfs/scratch60/fas/sbsc/ga254/dataproces/MERIT_HYDRO > v.info
>  map=stream
> >
> +----------------------------------------------------------------------------+
> >  | Name:            stream
>       |
> >  | Mapset:          PERMANENT
>      |
> >  | Location:        tmploc
>       |
> >  | Database:        /tmp/grass7-ga254-25033
>      |
> >  | Title:
>      |
> >  | Map scale:       1:1
>      |
> >  | Name of creator: ga254
>      |
> >  | Organization:
>       |
> >  | Source date:     Thu Apr 23 14:42:51 2020
>       |
> >  | Timestamp (first layer): none
>       |
> >
> |----------------------------------------------------------------------------|
> >  | Map format:      native
>       |
> >
> |----------------------------------------------------------------------------|
> >  |   Type of map: vector (level: 2)
>      |
> >  |
>       |
> >  |   Number of points:       250905          Number of centroids:  0
>       |
> >  |   Number of lines:        245570          Number of boundaries: 0
>       |
> >  |   Number of areas:        0               Number of islands:    0
>       |
> >  |
>       |
> >  |   Map is 3D:              No
>      |
> >  |   Number of dblinks:      1
>       |
> >  |
>       |
> >  |   Projection: Latitude-Longitude
>      |
> >  |
>       |
> >  |               N:       77:06:40.5N    S:       73:10:55.5N
>      |
> >  |               E:      158:07:46.5E    W:      135:26:34.5E
>      |
> >  |
>       |
> >  |   Digitization threshold: 0
>       |
> >  |   Comment:
>      |
> >  |
>       |
> >
> +----------------------------------------------------------------------------+
> >
> >
> >
> > --
> > Giuseppe Amatulli, Ph.D.
> >
> > Research scientist at
> > School of Forestry & Environmental Studies
> > Center for Research Computing
> > Yale University
> > New Haven, CT, USA
> > 06511
> > Teaching: http://spatial-ecology.net
> > Work:  https://environment.yale.edu/profile/giuseppe-amatulli/
> > _______________________________________________
> > grass-user mailing list
> > grass-user at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
> --
> Markus Neteler, PhD
> https://www.mundialis.de - free data with free software
> https://grass.osgeo.org
> https://courses.neteler.org/blog
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user



-- 
Huidae Cho, Ph.D., GISP
GRASS GIS Developer
https://idea.isnew.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20200429/e562e5b6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 33541 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20200429/e562e5b6/attachment-0001.png>


More information about the grass-user mailing list