[GRASSLIST:3599] Re: problems with grass 5.0.0pre3

rgrmill at rt66.com rgrmill at rt66.com
Fri Apr 26 14:54:07 EDT 2002


Andriy wrote:

> I am using Red Hat 7.2 and I have recently installed
> the newest version ofgrass (5.0.0.pre3). The problem I have 
encountered is
> how to reclass NODATA in raster files into numerical values that 
could
> be used to perform someuseful calculations. The problem is that I 
cannot use
> any mathematicaloperations when NO DATA is present and I cannot 
manage
> to reclass that. Itried r.reclass but it did not help.

You can use r.mapcalc to change the NODATA (or NULL) value to something 
else.  The form would be something like 

r.mapcalc "output=if(isnull(input),new_value,input)"

in which input and output would be replaced with the names of you input 
and output raster files, respectively and new_value would be some 
integer that you want to replace the NODATA values.  The quotation marks 
in this example are required.

If your map is of type CELL then you should be able to reclass your 
output map with r.reclass. Instances where you need to do this 
replacement should be rare.  If you truly have no data then you really 
can't do very much that is useful.

> The other problem occurs when I am importing dxf and
> tiff file formats. Thewhole map contains only NO DATA (tiff) or 0 
(dxf). I
> ran v.support andg.region, the map displayed correctly but was 
useless
> for any furtheranalysis. I couldn't reclass that dxf either.

TIFF and DXF formats are handled through completely different import 
tools and result in completely different types of files; TIFF files 
import to raster files and DXF files import to vector files.  You would 
not run v.support on an imported TIFF file.

You don't provide much basis for me to give you help, so these 
suggestions are generic.

Use r.in.gdal to import the TIFF file.  If the file is not georeferenced 
(a tiff world file) then you will probably want to  georeference the 
raster file after it is imported.  You can georeference the raster file 
either by editing the header with r.support or by registering it with 
i.rectify.  There may be other tools as well.

Use v.in.dxf to import the DXF file.  v.in.dxf is fairly robust, but it 
does not handle all types of dxf objects.  Keep in mind that DXF files 
are often not in geographic coordinates.  If that is true in your case 
then you may be able to use v.transform to supply the necessary 
coordinates.  You should be able to view the imported file in a GRASS 
monitor without first running v.support, but that is about all you can 
do with the file.

The GRASS monitor displays data within pre-set coordinates.  If the 
coordinates of your imported file are not within those pre-set 
coordinates then you will need to adjust the screen coordinates before 
you can view the file.  Do that with g.region rast=<raster map name> or 
g.region vect=<vector map name>.


Good luck,
Roger Miller



More information about the grass-user mailing list