Re: [GRASS-user] Merge spatially connected features

2020-02-24 Thread Micha Silver


On 24/02/2020 10:45, Johannes Radinger wrote:

Hi all,
I have a large river network dataset (lines). Now I'd to assign unique 
categories to each group of connected lines that have an attribute in 
common.


For example, my rivers are categorized based on some kind of stream 
order. I want to group all rivers that belong to stream order 2 and 
are spatially connected; each group should get a unique category 
value. I thought that I could first extract all rivers with a 
particular attribute (e.g. stream order = 2) which will provide me 
some scattered pattern of lines. Then I need a spatial join tool to 
make subgroups of lines that are connected. How can I achieve the 
latter? Any idea?



Here's a procedure that might work for you. Somewhat clunky, but I think 
it gets what you want.


It's based on the v.build.polylines module to connect all touching 
stream reaches. First extract each order from the stream vector into a 
new vector. Then build polylines. Patch them all together. Now you have 
a polyline vector with a single cat value for each set of original 
stream reaches that had the same order and that were touching.


Finally, with v.distance you can upload that cat value to the original 
streams.



# Get a list of stream orders
ORDERS=`v.db.select -c streams group=strahler column=strahler`
echo $ORDERS
#1 2 3 4 5 6
# How many stream segments in original
v.info -t streams | grep lines
# lines=1420

# Now loop thru list of stream orders and extract stream segments for 
each order

for o in $ORDERS; do
    v.extract input=streams output=streams_${o} where="strahler=${o}"
    # Create polyline for each stream order
    # Line "connects" all touching stream segments
    v.build.polylines input=streams_${o} 
output=streams_${o}_polyline type=line cat=first

done

# Patch stream order polylines together
POLYLINES=`g.list vect pattern="streams*polyline" separator=comma`
echo $POLYLINES
v.patch input=$POLYLINES output=streams_polylines
v.info -t streams_polylines | grep lines
# lines=738

# Add a new column to the original streams for new ID value
v.db.addcolumn map=streams column="merged_id INTEGER"
# And use v.distance to update that column from cat values in polylines 
vector

v.distance from=streams to=streams_polylines upload=cat column=merged_id

HTH


Cheers,
Johannes

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


--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918
https://orcid.org/-0002-1128-1325

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

Re: [GRASS-user] NASADEM: new global 1 arcsec DEM

2020-02-24 Thread Markus Neteler
Hi Markus,

On Tue, Feb 18, 2020 at 10:36 PM Markus Metz
 wrote:
>
> Hi all,
>
> NASA via lpdaac has released a new global DEM with 1 arcsec spatial 
> resolution:
> https://lpdaac.usgs.gov/news/release-nasadem-data-products/
>
> "NASADEM extends the legacy of the Shuttle Radar Topography Mission (SRTM) by 
> improving the digital elevation model (DEM) height accuracy and data coverage 
> as well as providing additional SRTM radar-related data products. The 
> improvements were achieved by reprocessing the original SRTM radar signal 
> data and telemetry data with updated algorithms and auxiliary data not 
> available at the time of the original SRTM processing."
>
> All layers of the NASADEM_HGT.001 product can be imported into GRASS with the 
> addon r.in.nasadem:
> https://github.com/OSGeo/grass-addons/tree/master/grass7/raster/r.in.nasadem
>
> Enjoy!
>
> Markus M
>
> https://lpdaac.usgs.gov/products/nasadem_hgtv001/

Great work, I could smoothly download and generate an Ecuador NASADEM mosaik.

For fun I made a small animation, comparing SRTM with the new NASADEM
in southern Ecuador:
https://twitter.com/MundialisInfo/status/1231951793661370375

The new gap-filling shows much more detail.

Best,
markusN
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[GRASS-user] Merge spatially connected features

2020-02-24 Thread Johannes Radinger
Hi all,
I have a large river network dataset (lines). Now I'd to assign unique
categories to each group of connected lines that have an attribute in
common.

For example, my rivers are categorized based on some kind of stream order.
I want to group all rivers that belong to stream order 2 and are spatially
connected; each group should get a unique category value. I thought that I
could first extract all rivers with a particular attribute (e.g. stream
order = 2) which will provide me some scattered pattern of lines. Then I
need a spatial join tool to make subgroups of lines that are connected. How
can I achieve the latter? Any idea?

Cheers,
Johannes
___
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user