[GRASS-user] v.breach addon

I want to make a hydrological corrected DEM, using v.surf.rst for
interpolation/aproximation and v.breach to introduce aditional elevation
points at streams.

My spatial reference system is EPSG:3763 ETRS89 / Portugal TM06,
(metrical).

As required in v.breach document:
- each input vect line have a unique category in layer 1;
- input lines not cross themselves;
- input lines not constitute loops;
- the input vector lines not stand out of the input raster DEM;
- the input lines direction is from upstream to downstream.

After creating a DEM using v.surf.rst I want to correct the false sinks
in narrow valleys and sparse points areas. Using v.breach I have as
result two output vectors for streams lines and points but without
entities or attributes. I tried with both PostgreSQL and Sqlite database
connections.

For PostgreSQL connection:

DBMI-Postgres driver error:
Cannot select:
SELECT cat,lcat,z,z_breach FROM topografia.vbreachpoints_2
ERROR: column "z" does not exist
LINE 1: SELECT cat,lcat,z,z_breach FROM
topografia.vbreachpoints_2
                        ^
Unable to open select cursor: 'SELECT cat,lcat,z,z_breach FROM
topografia.vbreachpoints_2'
Copy table failed
Table <vbreach_2> does not exist in database
<host=localhost,dbname=grass_pp_muda_pttm06>
The table <vbreach_2> is now part of vector map <vbreach> and may be
deleted or overwritten by GRASS modules
DBMI-Postgres driver error:
Cannot create index:
create unique index vbreach_2_cat on vbreach_2 ( cat )
ERROR: relation "vbreach_2" does not exist
Cannot create index
DBMI-Postgres driver error:
Cannot grant on table:
grant select on vbreach_2 to public
ERROR: relation "vbreach_2" does not exist
Cannot grant privileges on table vbreach_2
Select privileges were granted on the table

Any ideas?
If wanted I'll send the files needed for replication.

Thank you

Luís Ferreira

Luís Ferreira pisze:

I want to make a hydrological corrected DEM, using v.surf.rst for interpolation/aproximation and v.breach to introduce aditional elevation points at streams.

My spatial reference system is EPSG:3763 ETRS89 / Portugal TM06, (metrical).

As required in v.breach document: - each input vect line have a unique category in layer 1; - input lines not cross themselves; - input lines not constitute loops; - the input vector lines not stand out of the input raster DEM; - the input lines direction is from upstream to downstream.

After creating a DEM using v.surf.rst I want to correct the false sinks in narrow valleys and sparse points areas. Using v.breach I have as result two output vectors for streams lines and points but without entities or attributes. I tried with both PostgreSQL and Sqlite database connections.

For PostgreSQL connection:

DBMI-Postgres driver error: Cannot select: SELECT cat,lcat,z,z_breach
FROM topografia.vbreachpoints_2 ERROR: column "z" does not exist LINE 1: SELECT cat,lcat,z,z_breach FROM topografia.vbreachpoints_2 ^
Unable to open select cursor: 'SELECT cat,lcat,z,z_breach FROM topografia.vbreachpoints_2' Copy table failed Table <vbreach_2> does not exist in database <host=localhost,dbname=grass_pp_muda_pttm06> The table <vbreach_2> is now part of vector map <vbreach> and may be
deleted or overwritten by GRASS modules DBMI-Postgres driver error:
Cannot create index: create unique index vbreach_2_cat on vbreach_2
( cat ) ERROR: relation "vbreach_2" does not exist Cannot create
index DBMI-Postgres driver error: Cannot grant on table: grant select
on vbreach_2 to public ERROR: relation "vbreach_2" does not exist Cannot grant privileges on table vbreach_2 Select privileges were granted on the table

Any ideas? If wanted I'll send the files needed for replication.

Luís,

Glad to see someone trying to use my stuff :).

What GRASS version do you use? What OS? What was your command line, exactly?

Maybe the culprit is the DB backend. I have never used the script with
anything else than DBF. Try to switch to DBF in GRASS (db.connect). Or a
GRASS version "too new". I think I used it only against 6.3. There
*might* have been changes to underlying GRASS modules.

I've written the script, and used it the last time, about 2 years ago.
It did the job fine then. I don't have a personal interest in developing
it at the moment. I could provide you a commercial support if you like.
That would include testing the script against your data, in a GRASS
setup similar to yours, and fixing the tool if necessary.

Please contact me in priv if you are interested. I don't charge much :).
Or, if there's a GRASS hacker willing to do it for free - please go
ahead, anybody.

Best,
Maciek

--
Maciej Sieczka
http://www.sieczka.org

Aftermath...

I had to change some strings to make v.breach work on GRASS 6.4svn
revision 39873, Ubuntu/Debian 9.10.

Luís Ferreira

-------------------------------------
line 310
v.parallel input="${OUTP}_grid_addcat_bnd_patch_break_ln_2l_tmp_${UNQ}"
output="${OUTP}_segm_2l_r_tmp_${UNQ}" distance=0.00001 --o > /dev/null
and
line 312
v.parallel input="${OUTP}_grid_addcat_bnd_patch_break_ln_2l_tmp_${UNQ}"
output="${OUTP}_segm_2l_l_tmp_${UNQ}" distance=-0.00001 --o > /dev/null

change to
                                v.parallel

input="${OUTP}_grid_addcat_bnd_patch_break_ln_2l_tmp_${UNQ}"
output="${OUTP}_segm_2l_r_tmp_${UNQ}" side=right distance=0.00001 --o

/dev/null

                                                v.parallel

input="${OUTP}_grid_addcat_bnd_patch_break_ln_2l_tmp_${UNQ}"
output="${OUTP}_segm_2l_l_tmp_${UNQ}" side=left distance=0.00001 --o

/dev/null

------------------------------------------
line 388
v.db.addcol map="${OUTP}" layer=2 'columns=x double, y double, z double,
z_breach double' > /dev/null

change to
                                v.db.addcol map="${OUTP}" layer=2
                                'columns=x double precision, y double
                                precision, z double precision, z_breach
                                double precision' > /dev/null
-------------------------------------------

line 474
db.execute input=$TMP.${PROG}.sql database=$dbs driver=$drv > /dev/null
change to
                db.execute input=$TMP.${PROG}.sql database=${database}
driver=
${driver} > /dev/null

-------------------------------------------

change $tbl to $table

------------------------------------------
v.clean tool=prune

defaulting to treshold=0.0

------------------------------------------
line 464
change to
table=`v.db.connect -g "${OUTP}" | awk '{print $2}'`
database=`v.db.connect -g "${OUTP}" | awk '{print $4}'`
driver=`v.db.connect -g "${OUTP}" | awk '{print $5}'`

----------------------------------------

make explicit field separator for awk
awk -F "|"

On Wed, 2009-12-02 at 21:35 +0100, Maciej Sieczka wrote:

Luís Ferreira pisze:
> I want to make a hydrological corrected DEM, using v.surf.rst for
> interpolation/aproximation and v.breach to introduce aditional
> elevation points at streams.
>
> My spatial reference system is EPSG:3763 ETRS89 / Portugal TM06,
> (metrical).
>
> As required in v.breach document: - each input vect line have a
> unique category in layer 1; - input lines not cross themselves; -
> input lines not constitute loops; - the input vector lines not stand
> out of the input raster DEM; - the input lines direction is from
> upstream to downstream.
>
> After creating a DEM using v.surf.rst I want to correct the false
> sinks in narrow valleys and sparse points areas. Using v.breach I
> have as result two output vectors for streams lines and points but
> without entities or attributes. I tried with both PostgreSQL and
> Sqlite database connections.
>
> For PostgreSQL connection:
>
> DBMI-Postgres driver error: Cannot select: SELECT cat,lcat,z,z_breach
> FROM topografia.vbreachpoints_2 ERROR: column "z" does not exist
> LINE 1: SELECT cat,lcat,z,z_breach FROM topografia.vbreachpoints_2 ^
> Unable to open select cursor: 'SELECT cat,lcat,z,z_breach FROM
> topografia.vbreachpoints_2' Copy table failed Table <vbreach_2> does
> not exist in database <host=localhost,dbname=grass_pp_muda_pttm06>
> The table <vbreach_2> is now part of vector map <vbreach> and may be
> deleted or overwritten by GRASS modules DBMI-Postgres driver error:
> Cannot create index: create unique index vbreach_2_cat on vbreach_2
> ( cat ) ERROR: relation "vbreach_2" does not exist Cannot create
> index DBMI-Postgres driver error: Cannot grant on table: grant select
> on vbreach_2 to public ERROR: relation "vbreach_2" does not exist
> Cannot grant privileges on table vbreach_2 Select privileges were
> granted on the table
>
> Any ideas? If wanted I'll send the files needed for replication.

Luís,

Glad to see someone trying to use my stuff :).

What GRASS version do you use? What OS? What was your command line, exactly?

Maybe the culprit is the DB backend. I have never used the script with
anything else than DBF. Try to switch to DBF in GRASS (db.connect). Or a
GRASS version "too new". I think I used it only against 6.3. There
*might* have been changes to underlying GRASS modules.

I've written the script, and used it the last time, about 2 years ago.
It did the job fine then. I don't have a personal interest in developing
it at the moment. I could provide you a commercial support if you like.
That would include testing the script against your data, in a GRASS
setup similar to yours, and fixing the tool if necessary.

Please contact me in priv if you are interested. I don't charge much :).
Or, if there's a GRASS hacker willing to do it for free - please go
ahead, anybody.

Best,
Maciek

(attachments)

v.breach_changed (20.5 KB)

Luís Ferreira pisze:

Aftermath...

I had to change some strings to make v.breach work on GRASS 6.4svn revision 39873, Ubuntu/Debian 9.10.

Can you send a diff (diff original_file your_file), as attachment?

Maciek

--
Maciej Sieczka
http://www.sieczka.org

Here is it :slight_smile:

Luís

On Mon, 2009-12-07 at 08:11 +0100, Maciej Sieczka wrote:

Luís Ferreira pisze:
> Aftermath...
>
> I had to change some strings to make v.breach work on GRASS 6.4svn
> revision 39873, Ubuntu/Debian 9.10.

Can you send a diff (diff original_file your_file), as attachment?

Maciek

(attachments)

diff.txt (4.35 KB)

Luís Ferreira pisze:

On Mon, 2009-12-07 at 08:11 +0100, Maciej Sieczka wrote:

Luís Ferreira pisze:

I had to change some strings to make v.breach work on GRASS
6.4svn revision 39873, Ubuntu/Debian 9.10.

Can you send a diff (diff original_file your_file), as attachment?

Here is it :slight_smile:

The problem with v.breach is down to v.parallel interface change in
v.parallel2 - option `distance' does not accept negative offsets
anymore, and introduces a new `side' option to distinguish left/right,
instead:

$ v.parallel in=lines out=lines_par dist=-1

ERROR: value <-1> out of range for parameter <distance>
        Legal range: 0-100000000

@Devs: It would be cool if v.parallel could be changed to accept
negative offsets, for compatibility within 6.x line.

@Luís: I applied most your of patch. Thanks! Are you sure that's all
errors? I keep on getting warnings like:

WARNING: Unable to get point on line: cat = 1 offset = 2.831711 (line
          length = 0)

at v.segment calls in the script, and a crash at v.in.ascii.

Best,
Maciek

--
Maciej Sieczka
http://www.sieczka.org

I used v.breach with both SQLite and dbf, with ETRS89 metric negative
coordinates, from 20m to 2m resolution and worked fine.

System: Ubuntu 9.10 Karmic Koala, 64 bits, GRASS 6.4SVN.

But I remember to see some warnings like yours. Are these warnings
critical? Visually, the interpolated DEMs with v.surf.rst are coherent.

Luís

On Mon, 2009-12-14 at 04:57 +0100, Maciej Sieczka wrote:

@Luís: I applied most your of patch. Thanks! Are you sure that's all
errors? I keep on getting warnings like:

WARNING: Unable to get point on line: cat = 1 offset = 2.831711 (line
          length = 0)

at v.segment calls in the script, and a crash at v.in.ascii.

Luís Ferreira pisze:

I used v.breach with both SQLite and dbf, with ETRS89 metric negative
coordinates, from 20m to 2m resolution and worked fine.

System: Ubuntu 9.10 Karmic Koala, 64 bits, GRASS 6.4SVN.

But I remember to see some warnings like yours. Are these warnings critical? Visually, the interpolated DEMs with v.surf.rst are
coherent.

I'll let you know next time I take a hobbyist look at v.breach. But I
really don't know when it will be.

Good luck.

Maciek

On Mon, 2009-12-14 at 04:57 +0100, Maciej Sieczka wrote:

@Luís: I applied most your of patch. Thanks! Are you sure that's
all errors? I keep on getting warnings like:

WARNING: Unable to get point on line: cat = 1 offset = 2.831711
(line length = 0)

at v.segment calls in the script, and a crash at v.in.ascii.

--
Maciej Sieczka
http://www.sieczka.org

Kubuntu 9.10 64bit, using GRASS 6.5.

I ran v.breach on a stream network extracted with r.stream.extract.
It runs through the program, and puts up an error dialogue at
v.parallel. Attached is the log file. It looks like a negative
number is being passed to v.parallel. I saw in the documentation this
might be a problematic module in the script for non-metric coordinate
system. Below is the portion of the output box from the module. Note
the error 11 lines down.

-------------------------------------------------------
Building topology for vector map <breach_pt_segm_2l_r_tmp_5636_0_v_breach_sh>...
Registering primitives...
100 primitives registered
259 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 100
ERROR: value <-0.00001> out of range for parameter <distance>
Number of primitives: 100
Number of points: 0
Number of lines: 100
Number of boundaries: 0
Number of centroids: 0
       Legal range: 0-100000000
Description:
Creates parallel line to input vector lines.
Keywords:
vector, geometry
-------------------------------------------------------

Should I look in the script for this portion, and check if it is a
metric issue? or does this seem like a different problem?

Thanks,
Mark

2009/12/14 Maciej Sieczka <msieczka@sieczka.org>:

Luís Ferreira pisze:

I used v.breach with both SQLite and dbf, with ETRS89 metric negative
coordinates, from 20m to 2m resolution and worked fine.

System: Ubuntu 9.10 Karmic Koala, 64 bits, GRASS 6.4SVN.

But I remember to see some warnings like yours. Are these warnings
critical? Visually, the interpolated DEMs with v.surf.rst are
coherent.

I'll let you know next time I take a hobbyist look at v.breach. But I
really don't know when it will be.

Good luck.

Maciek

On Mon, 2009-12-14 at 04:57 +0100, Maciej Sieczka wrote:

@Luís: I applied most your of patch. Thanks! Are you sure that's
all errors? I keep on getting warnings like:

WARNING: Unable to get point on line: cat = 1 offset = 2.831711
(line length = 0)

at v.segment calls in the script, and a crash at v.in.ascii.

--
Maciej Sieczka
http://www.sieczka.org

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

(attachments)

v.breach.log (892 Bytes)

Luis:

I noticed you mentioned you had run it with sqlite and dbf database
drivers. Mine is mapped to sqlite currently. I see some v.to.db
commands in the script, but do I understand correctly that you didnt
have issues using sqlite as backend?

Thanks,
Mark

2009/12/14 Luís Ferreira <lferreira75.1@gmail.com>:

I used v.breach with both SQLite and dbf, with ETRS89 metric negative
coordinates, from 20m to 2m resolution and worked fine.

System: Ubuntu 9.10 Karmic Koala, 64 bits, GRASS 6.4SVN.

But I remember to see some warnings like yours. Are these warnings
critical? Visually, the interpolated DEMs with v.surf.rst are coherent.

Luís

On Mon, 2009-12-14 at 04:57 +0100, Maciej Sieczka wrote:

@Luís: I applied most your of patch. Thanks! Are you sure that's all
errors? I keep on getting warnings like:

WARNING: Unable to get point on line: cat = 1 offset = 2.831711 (line
length = 0)

at v.segment calls in the script, and a crash at v.in.ascii.

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

M S pisze:

Kubuntu 9.10 64bit, using GRASS 6.5.

I ran v.breach on a stream network extracted with r.stream.extract.
It runs through the program, and puts up an error dialogue at
v.parallel. Attached is the log file. It looks like a negative
number is being passed to v.parallel. I saw in the documentation this
might be a problematic module in the script for non-metric coordinate
system. Below is the portion of the output box from the module. Note
the error 11 lines down.

-------------------------------------------------------
Building topology for vector map <breach_pt_segm_2l_r_tmp_5636_0_v_breach_sh>...
Registering primitives...
100 primitives registered
259 vertices registered
Building areas...
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 100
ERROR: value <-0.00001> out of range for parameter <distance>
Number of primitives: 100
Number of points: 0
Number of lines: 100
Number of boundaries: 0
Number of centroids: 0
       Legal range: 0-100000000
Description:
Creates parallel line to input vector lines.
Keywords:
vector, geometry
-------------------------------------------------------

Should I look in the script for this portion, and check if it is a
metric issue? or does this seem like a different problem?

A different one. v.parallel used to accept negative offsets to distinguish left/right. Now (after v.parallel2 replaced it) it doesn't accept negative offsets anymore.

Maciek

2009/12/14 Maciej Sieczka <msieczka@sieczka.org>:

Luís Ferreira pisze:

I used v.breach with both SQLite and dbf, with ETRS89 metric negative
coordinates, from 20m to 2m resolution and worked fine.

System: Ubuntu 9.10 Karmic Koala, 64 bits, GRASS 6.4SVN.

But I remember to see some warnings like yours. Are these warnings
critical? Visually, the interpolated DEMs with v.surf.rst are
coherent.

I'll let you know next time I take a hobbyist look at v.breach. But I
really don't know when it will be.

Good luck.

Maciek

On Mon, 2009-12-14 at 04:57 +0100, Maciej Sieczka wrote:

@Luís: I applied most your of patch. Thanks! Are you sure that's
all errors? I keep on getting warnings like:

WARNING: Unable to get point on line: cat = 1 offset = 2.831711
(line length = 0)

at v.segment calls in the script, and a crash at v.in.ascii.

--
Maciej Sieczka
http://www.sieczka.org

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

--
Maciej Sieczka
http://www.sieczka.org

Yes, it worked with sqlite db connection.

Luís

On Mon, 2009-12-14 at 15:52 -0500, M S wrote:

Luis:

I noticed you mentioned you had run it with sqlite and dbf database
drivers. Mine is mapped to sqlite currently. I see some v.to.db
commands in the script, but do I understand correctly that you didnt
have issues using sqlite as backend?