[prev in list] [next in list] [prev in thread] [next in thread] 

List:       grass-user
Subject:    Re: [GRASS-user] derive points outlet from r.stream.extract
From:       Giuseppe Amatulli <giuseppe.amatulli () gmail ! com>
Date:       2020-04-30 0:11:18
Message-ID: CAKoiDH+gy1ZjHVRRsrY04DWBWf73WU8PvSVNTFgkHDdjKVv0rA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/related)]

[Attachment #4 (multipart/alternative)]


Thanks Huidae (& Markus),
I was writing to the list when I get your message.
In the end, I discover that the outlet are visible by v.category
v.category  input=stream layer=2 type=point option=print
and I was able to directly convert to raster by
v.to.rast input=stream  type=point use=cat label_column=type_code
output=outlet cats=2

Probably is good to insert in the manual that the layer=2 is visible with
v.category.

Thanks again
Giuseppe
p.s. I will write another message concerning some border effect in
r.stream.basins

On Wed, 29 Apr 2020 at 19:19, Huidae Cho <grass4u@gmail.com> wrote:

> 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@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@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@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@lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/grass-user
>
>
>
> --
> Huidae Cho, Ph.D., GISP
> GRASS GIS Developer
> https://idea.isnew.info
>


-- 
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/

[Attachment #7 (text/html)]

<div dir="ltr"><font color="#000000">Thanks  Huidae (&amp; Markus),</font><div><font \
color="#000000">I was writing to the list when I get your message.<br>In the end, I \
discover that the outlet are visible by v.category<br>v.category   input=stream \
layer=2 type=point option=print<br>and I was able to directly convert to raster \
by<br>v.to.rast input=stream   type=point use=cat label_column=type_code \
output=outlet cats=2<br><br>Probably is good to insert in the manual that the layer=2 \
is visible with v.category.<br><br>Thanks again <br>Giuseppe <br>p.s. I will write \
another message concerning some border effect in r.stream.basins \
</font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On \
Wed, 29 Apr 2020 at 19:19, Huidae Cho &lt;<a \
href="mailto:grass4u@gmail.com">grass4u@gmail.com</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div \
dir="ltr"><div>Giuseppe,</div><div><br></div><div>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.</div><div><div><img src="cid:ii_k9lxz1h70" \
alt="image.png" width="416" height="318"><br></div><div><br></div><div>Now, you want \
to extract the outlets.</div><div><br></div><div>v.extract input=extract_output \
layer=2 cat=2 output=outlets1</div><div><br></div><div>The outlets are still in layer \
2 in the outlets1 map and they all have the same cat (2).<br></div><div>v.category \
map=outlets1 option=report</div><div><br></div><div>Change the layer from 2 to \
1.</div><div>v.category input=outlets1 layer=2,1 option=chlayer \
output=outlets2</div><div><br></div><div>Delete all cats (2) because they&#39;re just \
the same.(useless).</div><div>v.category input=outlets2 option=del cat=-1 \
output=outlets3<br></div><div><br></div><div>Add unique cats.</div><div>v.category \
input=outlets3 option=add output=final_outlets</div><div><br></div><div>Let&#39;s \
see.</div><div>v.report map=final_outlets option=coor</div><div><br></div><div>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.</div><div>v.db.addtable map=final_outlets \
column=&#39;src_cat int&#39;</div><div><br></div><div>v.what.vect map=final_outlets \
col=src_cat query_map=extract_output \
query_column=cat</div><div><div><br></div><div>Check<br></div><div>v.report \
map=final_outlets option=coor</div><div><br></div><div>Hope this \
helps.</div><div><br></div><div>Best,</div><div>Huidae<br></div></div><div><br></div></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 27, 2020 at 6:25 AM \
Markus Neteler &lt;<a href="mailto:neteler@osgeo.org" \
target="_blank">neteler@osgeo.org</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">Hi Giuseppe,<br> <br>
Could you post a reproducible example with North Carolina samle data?<br>
(being tight on time it would help)<br>
<br>
Best<br>
Markus<br>
<br>
On Thu, Apr 23, 2020 at 8:53 PM Giuseppe Amatulli<br>
&lt;<a href="mailto:giuseppe.amatulli@gmail.com" \
target="_blank">giuseppe.amatulli@gmail.com</a>&gt; wrote:<br> &gt;<br>
&gt; Hi,<br>
&gt; I&#39;m trying to extract the outlet location from the<br>
&gt; r.stream.extract stream_vector=stream   attribute.<br>
&gt; In particular the manual for r.stream.extract reports:<br>
&gt;<br>
&gt; &quot;In layer 2, categories are identical to type_code in layer 1 with \
additional category 2 = outlet for outlet points.&quot;<br> &gt;<br>
&gt; I want to be able to extract only the points of layer 2 where category = 2.<br>
&gt; However when I run<br>
&gt;<br>
&gt; v.db.connect   -p     map=stream<br>
&gt; Vector map &lt;stream&gt; is connected by:<br>
&gt; layer &lt;1/stream&gt; table &lt;stream&gt; in database \
&lt;/tmp/grass7-ga254-12721/tmploc/PERMANENT/sqlite/sqlite.db&gt; through driver \
&lt;sqlite&gt; with key &lt;cat&gt;<br> &gt;<br>
&gt; I can see only layer 1 (which does not contain category 2).<br>
&gt;<br>
&gt; Is there a way to connect to layer 2?<br>
&gt; How I can be sure that also layer 2 has been created and is not missing?<br>
&gt; Thanks<br>
&gt; Giuseppe<br>
&gt;<br>
&gt; GRASS 7.6.0 (tmploc):/gpfs/scratch60/fas/sbsc/ga254/dataproces/MERIT_HYDRO &gt; \
<a href="http://v.info" rel="noreferrer" target="_blank">v.info</a>     \
map=stream<br> &gt;   \
+----------------------------------------------------------------------------+<br> \
&gt;   | Name:                  stream                                                \
|<br> &gt;   | Mapset:               PERMANENT                                        \
|<br> &gt;   | Location:            tmploc                                            \
|<br> &gt;   | Database:            /tmp/grass7-ga254-25033                           \
|<br> &gt;   | Title:                                                                 \
|<br> &gt;   | Map scale:           1:1                                               \
|<br> &gt;   | Name of creator: ga254                                                 \
|<br> &gt;   | Organization:                                                          \
|<br> &gt;   | Source date:        Thu Apr 23 14:42:51 2020                           \
|<br> &gt;   | Timestamp (first layer): none                                          \
|<br> &gt;   |----------------------------------------------------------------------------|<br>
 &gt;   | Map format:         native                                                  \
|<br> &gt;   |----------------------------------------------------------------------------|<br>
 &gt;   |     Type of map: vector (level: 2)                                          \
|<br> &gt;   |                                                                        \
|<br> &gt;   |     Number of points:           250905               Number of \
centroids:   0               |<br> &gt;   |     Number of lines:            245570    \
Number of boundaries: 0               |<br> &gt;   |     Number of areas:            \
0                       Number of islands:      0               |<br> &gt;   |        \
|<br> &gt;   |     Map is 3D:                     No                                  \
|<br> &gt;   |     Number of dblinks:         1                                       \
|<br> &gt;   |                                                                        \
|<br> &gt;   |     Projection: Latitude-Longitude                                     \
|<br> &gt;   |                                                                        \
|<br> &gt;   |                       N:           77:06:40.5N      S:           \
73:10:55.5N                          |<br> &gt;   |                       E:         \
158:07:46.5E      W:         135:26:34.5E                          |<br> &gt;   |     \
|<br> &gt;   |     Digitization threshold: 0                                          \
|<br> &gt;   |     Comment:                                                           \
|<br> &gt;   |                                                                        \
|<br> &gt;   +----------------------------------------------------------------------------+<br>
 &gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Giuseppe Amatulli, Ph.D.<br>
&gt;<br>
&gt; Research scientist at<br>
&gt; School of Forestry &amp; Environmental Studies<br>
&gt; Center for Research Computing<br>
&gt; Yale University<br>
&gt; New Haven, CT, USA<br>
&gt; 06511<br>
&gt; Teaching: <a href="http://spatial-ecology.net" rel="noreferrer" \
target="_blank">http://spatial-ecology.net</a><br> &gt; Work:   <a \
href="https://environment.yale.edu/profile/giuseppe-amatulli/" rel="noreferrer" \
target="_blank">https://environment.yale.edu/profile/giuseppe-amatulli/</a><br> &gt; \
_______________________________________________<br> &gt; grass-user mailing list<br>
&gt; <a href="mailto:grass-user@lists.osgeo.org" \
target="_blank">grass-user@lists.osgeo.org</a><br> &gt; <a \
href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br> <br>
<br>
<br>
-- <br>
Markus Neteler, PhD<br>
<a href="https://www.mundialis.de" rel="noreferrer" \
target="_blank">https://www.mundialis.de</a> - free data with free software<br> <a \
href="https://grass.osgeo.org" rel="noreferrer" \
target="_blank">https://grass.osgeo.org</a><br> <a \
href="https://courses.neteler.org/blog" rel="noreferrer" \
target="_blank">https://courses.neteler.org/blog</a><br> \
_______________________________________________<br> grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" \
target="_blank">grass-user@lists.osgeo.org</a><br> <a \
href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" \
target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a></blockquote></div><br \
clear="all"><br>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span><div><div dir="ltr">Huidae \
Cho, Ph.D., GISP</div><div dir="ltr">GRASS GIS Developer</div><div><a \
href="https://idea.isnew.info" \
target="_blank">https://idea.isnew.info</a><br></div></div></span></div></div></div></div></div></div></div></div></div></div>
 </blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" \
class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div \
dir="ltr"><div><div dir="ltr"><div>Giuseppe Amatulli, Ph.D.<br><br>Research scientist \
at<br><span>School of Forestry &amp; Environmental Studies<br></span><span>Center for \
Research Computing</span><br>Yale University</div><div>New Haven, CT, \
USA</div><div>06511<br><div>  Teaching: <a href="http://spatial-ecology.net" \
target="_blank">http://spatial-ecology.net</a></div>   
   Work:   <a href="https://environment.yale.edu/profile/giuseppe-amatulli/" \
target="_blank">https://environment.yale.edu/profile/giuseppe-amatulli/</a> \
<br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>



["image.png" (image/png)]
[Attachment #9 (text/plain)]

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic