[GRASS-dev] [GRASS GIS] #3387: r.to.vect fails on a properly thinned tif via r.thin/r.null

#3387: r.to.vect fails on a properly thinned tif via r.thin/r.null
---------------------+-------------------------
Reporter: hbgdal | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone:
Component: Default | Version: 7.2.0
Keywords: | CPU: Unspecified
Platform: Linux |
---------------------+-------------------------
Hi, This happens only on a small number of tif files. Most of the tif
files are processed successfully. Commands to reproduce problem with 7.2.0
are pasted below. I would appreciate any workaround/patch(for 7.2.0 or any
other version) for this fix.

Problem:
For some tifs, the r.to.vect fails complaining that the image needs to be
thinned, and then hangs with a message about busy SQLite DB.

Expected behavior:
Either r.to.vect should extract lines from thinned image, or r.thin should
thin the image further.

Env:
Ubuntu 14.04. 7.2.0 compiled

Commands to run:
#This is "binary" image with two colors black and white
r.in.gdal input=/tmp/grass_problem.tif output=grass_problem
location=grass_problem

#Replace "white" color with null for r.thin.
r.null --verbose map=grass_problem@PERMANENT setnull=255

#r.thin succeeds in less than 10 iterations.(See output below)
r.thin --verbose input=grass_problem@PERMANENT output=grass_thin

#r.to.vect complains.
r.to.vect --verbose input=grass_thin@PERMANENT output=vec_lines type=line

===== r.thin output showing success ====
Raster map <grass_problem@PERMANENT> - 4028 rows X 3288 columns
Bounding box: l = 3, r = 3284, t = 7, b = 4028
Pass number 1
Deleted 240415 pixels
Pass number 2
Deleted 5154 pixels
Pass number 3
Deleted 115 pixels
Pass number 4
Deleted 5 pixels
Pass number 5
Deleted 0 pixels
Thinning completed successfully.
Output map 4028 rows X 3288 columns
Window 4028 rows X 3288 columns
(Thu Aug 3 11:17:10 2017) Command finished (2 sec)

=== r.to.vect output showing failure ===

r.to.vect --verbose input=grass_thin@PERMANENT output=vec_lines type=line
Using native format
Extracting lines...
Crowded cell at (362.125000, 12883.540000): row 424, col 1721, count 7
ERROR: Raster map is not thinned properly.
Please run r.thin.
WARNING: Busy SQLITE db, already waiting for 10 seconds.
....

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3387&gt;
GRASS GIS <https://grass.osgeo.org>

#3387: r.to.vect fails on a properly thinned tif via r.thin/r.null
--------------------------+-------------------------
  Reporter: hbgdal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Default | Version: 7.2.0
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Changes (by hbgdal):

* Attachment "grass_problem_tif_gz_part00" added.

part 00 of gzipped tif file

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3387&gt;
GRASS GIS <https://grass.osgeo.org>

#3387: r.to.vect fails on a properly thinned tif via r.thin/r.null
--------------------------+-------------------------
  Reporter: hbgdal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Default | Version: 7.2.0
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Changes (by hbgdal):

* Attachment "grass_problem_tif_gz_part01" added.

part 01 of gzipped tif file

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3387&gt;
GRASS GIS <https://grass.osgeo.org>

#3387: r.to.vect fails on a properly thinned tif via r.thin/r.null
--------------------------+-------------------------
  Reporter: hbgdal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: Raster | Version: 7.2.0
Resolution: | Keywords: r.to.vect
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Changes (by martinl):

* keywords: => r.to.vect
* component: Default => Raster
* milestone: => 7.2.2

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3387#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3387: r.to.vect fails on a properly thinned tif via r.thin/r.null
--------------------------+-------------------------
  Reporter: hbgdal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: Raster | Version: 7.2.0
Resolution: | Keywords: r.to.vect
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Description changed by martinl:

Old description:

Hi, This happens only on a small number of tif files. Most of the tif
files are processed successfully. Commands to reproduce problem with
7.2.0 are pasted below. I would appreciate any workaround/patch(for 7.2.0
or any other version) for this fix.

Problem:
For some tifs, the r.to.vect fails complaining that the image needs to be
thinned, and then hangs with a message about busy SQLite DB.

Expected behavior:
Either r.to.vect should extract lines from thinned image, or r.thin
should thin the image further.

Env:
Ubuntu 14.04. 7.2.0 compiled

Commands to run:
#This is "binary" image with two colors black and white
r.in.gdal input=/tmp/grass_problem.tif output=grass_problem
location=grass_problem

#Replace "white" color with null for r.thin.
r.null --verbose map=grass_problem@PERMANENT setnull=255

#r.thin succeeds in less than 10 iterations.(See output below)
r.thin --verbose input=grass_problem@PERMANENT output=grass_thin

#r.to.vect complains.
r.to.vect --verbose input=grass_thin@PERMANENT output=vec_lines type=line

===== r.thin output showing success ====
Raster map <grass_problem@PERMANENT> - 4028 rows X 3288 columns
Bounding box: l = 3, r = 3284, t = 7, b = 4028
Pass number 1
Deleted 240415 pixels
Pass number 2
Deleted 5154 pixels
Pass number 3
Deleted 115 pixels
Pass number 4
Deleted 5 pixels
Pass number 5
Deleted 0 pixels
Thinning completed successfully.
Output map 4028 rows X 3288 columns
Window 4028 rows X 3288 columns
(Thu Aug 3 11:17:10 2017) Command finished (2 sec)

=== r.to.vect output showing failure ===

r.to.vect --verbose input=grass_thin@PERMANENT output=vec_lines type=line
Using native format
Extracting lines...
Crowded cell at (362.125000, 12883.540000): row 424, col 1721, count 7
ERROR: Raster map is not thinned properly.
Please run r.thin.
WARNING: Busy SQLITE db, already waiting for 10 seconds.
....

New description:

Hi, This happens only on a small number of tif files. Most of the tif
files are processed successfully. Commands to reproduce problem with 7.2.0
are pasted below. I would appreciate any workaround/patch(for 7.2.0 or any
other version) for this fix.

Problem:
For some tifs, the r.to.vect fails complaining that the image needs to be
thinned, and then hangs with a message about busy SQLite DB.

Expected behavior:
Either r.to.vect should extract lines from thinned image, or r.thin should
thin the image further.

Env:
Ubuntu 14.04. 7.2.0 compiled

Commands to run:

{{{
#This is "binary" image with two colors black and white
r.in.gdal input=/tmp/grass_problem.tif output=grass_problem
location=grass_problem

#Replace "white" color with null for r.thin.
r.null --verbose map=grass_problem@PERMANENT setnull=255

#r.thin succeeds in less than 10 iterations.(See output below)
r.thin --verbose input=grass_problem@PERMANENT output=grass_thin

#r.to.vect complains.
r.to.vect --verbose input=grass_thin@PERMANENT output=vec_lines type=line

===== r.thin output showing success ====
Raster map <grass_problem@PERMANENT> - 4028 rows X 3288 columns
Bounding box: l = 3, r = 3284, t = 7, b = 4028
Pass number 1
Deleted 240415 pixels
Pass number 2
Deleted 5154 pixels
Pass number 3
Deleted 115 pixels
Pass number 4
Deleted 5 pixels
Pass number 5
Deleted 0 pixels
Thinning completed successfully.
Output map 4028 rows X 3288 columns
Window 4028 rows X 3288 columns
(Thu Aug 3 11:17:10 2017) Command finished (2 sec)

=== r.to.vect output showing failure ===

r.to.vect --verbose input=grass_thin@PERMANENT output=vec_lines type=line
Using native format
Extracting lines...
Crowded cell at (362.125000, 12883.540000): row 424, col 1721, count 7
ERROR: Raster map is not thinned properly.
Please run r.thin.
WARNING: Busy SQLITE db, already waiting for 10 seconds.
....
}}}

--

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3387#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3387: r.to.vect fails on a properly thinned tif via r.thin/r.null
--------------------------+-------------------------
  Reporter: hbgdal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Default | Version: 7.2.0
Resolution: | Keywords:
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Changes (by hbgdal):

* keywords: r.to.vect =>
* component: Raster => Default
* milestone: 7.2.2 =>

Comment:

There is a limit on the attachment to the bug. I had to split the file in
two. If there is better way of adding the tif, please let me know.

  Here is how to
extract grass_problem.tif from the two attachments

cat grass_problem_tif_gz_part00 grass_problem_tif_gz_part01 >
grass_problem.tif.gz
gunzip grass_problem.tif.gz

Md5sum for the original tif file.
e9d09f96f85fa4bc55a3d2a0b255c509 grass_problem.tif

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3387#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3387: r.to.vect fails on a properly thinned tif via r.thin/r.null
--------------------------+-------------------------
  Reporter: hbgdal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone:
Component: Default | Version: 7.2.0
Resolution: | Keywords: r.to.vect
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Changes (by martinl):

* keywords: => r.to.vect

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3387#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3387: r.to.vect fails on a properly thinned tif via r.thin/r.null
--------------------------+-------------------------
  Reporter: hbgdal | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.2.2
Component: Raster | Version: 7.2.0
Resolution: | Keywords: r.to.vect
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Changes (by martinl):

* component: Default => Raster
* milestone: => 7.2.2

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3387#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>