Opened 7 years ago

Last modified 6 years ago

#3387 new defect

r.to.vect fails on a properly thinned tif via r.thin/r.null

Reported by: hbgdal Owned by: grass-dev@…
Priority: normal Milestone: 7.2.4
Component: Raster Version: 7.2.0
Keywords: r.to.vect Cc:
CPU: Unspecified Platform: Linux

Description (last modified by martinl)

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

Attachments (2)

grass_problem_tif_gz_part00 (488.3 KB ) - added by hbgdal 7 years ago.
part 00 of gzipped tif file
grass_problem_tif_gz_part01 (364.5 KB ) - added by hbgdal 7 years ago.
part 01 of gzipped tif file

Download all attachments as: .zip

Change History (10)

by hbgdal, 7 years ago

Attachment: grass_problem_tif_gz_part00 added

part 00 of gzipped tif file

by hbgdal, 7 years ago

Attachment: grass_problem_tif_gz_part01 added

part 01 of gzipped tif file

comment:1 by martinl, 7 years ago

Component: DefaultRaster
Keywords: r.to.vect added
Milestone: 7.2.2

comment:2 by martinl, 7 years ago

Description: modified (diff)

comment:3 by hbgdal, 7 years ago

Component: RasterDefault
Keywords: r.to.vect removed
Milestone: 7.2.2

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

Last edited 7 years ago by martinl (previous) (diff)

comment:4 by martinl, 7 years ago

Keywords: r.to.vect added

comment:5 by martinl, 7 years ago

Component: DefaultRaster
Milestone: 7.2.2

comment:6 by neteler, 7 years ago

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:7 by martinl, 6 years ago

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:8 by martinl, 6 years ago

Milestone: 7.2.4
Note: See TracTickets for help on using tickets.