[GRASS-user] Importing .tiff values

Moritz Lennert mlennert at club.worldonline.be
Thu Jul 10 06:35:41 EDT 2008


On 10/07/08 11:05, Jana K. wrote:
> Hello, could someone help me, please? I am rather new in grass, so far 
> I've succeeded making basic operations like creating locations, mapsets, 
> importing maps, converting projections, etc. I have downloaded european 
> landuse file which is in TIFF format. Unzipping produced several files, 
> besides the .tiff, with these extensions: .tfw, .aux, .tif.xml, .prj and 
> a .xls file containing a legend. Data in the map are categorical, the 
> legend contains reference of each category to a particular r:g:b color 
> in the map. I successfully imported the map to a new location, where I 
> set projection manually using the g.setproj, using info in .prj file. I 
> displayed the map and it seemed OK. Now, HERE IS MY PROBLEM: I used 
> r.cats to find out what are the categories in the raster file resulting 
> from the .tiff import. It gave me 44 categories from 1 to 44, apparently 
> with no labels attached. I suppose the labels need to be attached 
> somehow manually, although I don't know how yet.

r.category
or
r.support


> However, the bigger 
> problem seems to be the fact that the .xls legend file contains r:g:b 
> values and I don't know how to attach them to the 44 categories to the 
> 44 r:g:b values in the .xls legend file. MY QUESTIONS: Is there a way in 
> grass to get information on which color corresponds to which category? 

r.colors with rules=

If you want to use the xls legend file, you will have to transform its 
content to a text file in r.colors format, i.e. something like this:

0  255:255:255
2  255:255:0
5  0:255:0

Depending on the way you .xls file is structured this should be a more 
or less painless export to space seperated text...


> How does r.in.ogr use the info contained in files other than .tiff, 
> .tfw, coming in the bundle, or does it use it at all?

No, AFAIK, it only uses the tiff and tfw files. I think you should be 
able to create a location with the correct projection system by using 
"Create new location by ... georeferenced file" and pointing it to the 
.prj file, but am not sure.


Moritz


More information about the grass-user mailing list