[GRASS-dev] [GRASS GIS] #2654: r.thin crashes
GRASS GIS
trac at osgeo.org
Sun Apr 19 18:30:08 PDT 2015
#2654: r.thin crashes
----------------------+-----------------------------------------------------
Reporter: pairmand | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.1
Component: Raster | Version: 7.0.0
Keywords: r.thin | Platform: MSWindows 7
Cpu: x86-64 |
----------------------+-----------------------------------------------------
Comment(by pairmand):
Thank you both for your help - I think it was actually multiple unrelated
problems.
If I create a new location/mapset then g.region -p produces;
{{{
g.region -p
projection: 99 (Transverse Mercator)
zone: 0
datum: nzgd2k
ellipsoid: grs80
north: 1
south: 0
west: 0
east: 1
nsres: 1
ewres: 1
rows: 1
cols: 1
cells: 1
(Mon Apr 20 11:50:24 2015) Command finished (0 sec)
}}}
If I then import the Imagine file with extend region and repeat I get;
{{{
r.in.gdal input=D:\temp_work\temukaSub_rasterEdges.img
output=temukaSub_rasterEdges -e
WARNING: Datum <NZGD2000_NTv2> not recognised by GRASS and no parameters
found
Raster map <temukaSub_rasterEdges> created.
Region for the current mapset updated
r.in.gdal complete.
(Mon Apr 20 11:53:07 2015) Command finished (0 sec)
(Mon Apr 20 11:53:20 2015)
g.region -p
projection: 99 (Transverse Mercator)
zone: 0
datum: nzgd2k
ellipsoid: grs80
north: 5117010
south: 0
west: 0
east: 1474010
nsres: 1
ewres: 1
rows: 5117010
cols: 1474010
cells: 7542523910100
(Mon Apr 20 11:53:20 2015) Command finished (0 sec)
}}}
That is, the map coordinates seem to be set to the north east corner but
south, west, cols and rows are all incorrect. This appears to be a bug
importing from the Imagine file using the gdal importer. If I try and thin
at this point then the thin crashes - see screenshot.
[[Image(http://trac.osgeo.org/grass/attachment/ticket/2654/GrassCrash.JPG)]]
However, if I use g.region to correct the above I get a result that looks
good;
{{{
g.region raster=temukaSub_rasterEdges
(Mon Apr 20 12:03:08 2015) Command finished (0 sec)
(Mon Apr 20 12:03:22 2015)
g.region -p
projection: 99 (Transverse Mercator)
zone: 0
datum: nzgd2k
ellipsoid: grs80
north: 5117010
south: 5108000
west: 1463000
east: 1474010
nsres: 10
ewres: 10
rows: 901
cols: 1101
cells: 992001
(Mon Apr 20 12:03:22 2015) Command finished (0 sec)
}}}
At this point running r.thin still produces an error and only appears to
have processed the middle section of the image.
{{{
...
Thinning not completed, consider to increase 'iterations' parameter.
Output map 901 rows X 1101 columns
Window 901 rows X 1101 columns
(Mon Apr 20 12:04:46 2015) Command finished (17 sec)
}}}
Setting 0 as null cells fixes that problem also;
{{{
r.null map=temukaSub_rasterEdges setnull=0
(Mon Apr 20 12:06:49 2015) Command finished (0 sec)
(Mon Apr 20 12:07:20 2015)
r.thin --overwrite input=temukaSub_rasterEdges at canTest
output=temukaThinned
Raster map <temukaSub_rasterEdges at canTest> - 901 rows X 1101 columns
Bounding box: l = 2, r = 1102, t = 2, b = 902
Pass number 1
Deleted 68577 pixels
Pass number 2
Deleted 2270 pixels
Pass number 3
Deleted 37 pixels
Pass number 4
Deleted 0 pixels
Thinning completed successfully.
Output map 901 rows X 1101 columns
Window 901 rows X 1101 columns
(Mon Apr 20 12:07:21 2015) Command finished (0 sec)
}}}
So I'm now a happy camper - but suggest there is a bug in the raster
importer, in that it doesn't set the extent correctly, and the
documentation of r.thin definitely needs to clarify that it is working on
nulls not zeros.
Thanks again for your help.
David
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2654#comment:3>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list