[GRASS-user] raster query on the basis of its labels

temiz temiz at deprem.gov.tr
Thu Jan 11 09:59:18 EST 2007


Michael Barton wrote:
> Temez,
>
> As usual with GRASS, there are several ways to do this. If you just want to
> *display* the cells from selected categories, you can do this in d.rast
> (raster layer in the GUI). For cell maps, you just specify...
>
> d.rast map=[geology] catlist=1,2,3,6
> d.rast map=[geology] catlist=1-3,6
>
> For floating point maps, use vallist instead of catlist.
>
> If you want to do something more sophisticated with single maps, you can use
> r.reclass (makes a 'virtual' map of selected categories) or r.recode (makes
> a 'real' map) of selected categories. That is, you can reclassify one group
> of categories into 1 and leave the rest NULL to show some part of your map.
>
> For more sophisticated queries, you can use r.cross that will produce a new
> map with all unique combinations of cell values for a series of maps.
>
> Or you can use the map calculator.
>
> Hope this helps.
>
> Michael
>
>
>
>
> On 1/10/07 11:16 AM, "temiz" <temiz at deprem.gov.tr> wrote:
>
>   
>> Jachym Cepicky wrote:
>>     
>>> hi,
>>>
>>>     if( @map, 1,0)
>>>
>>> should work
>>>
>>> jachym
>>>
>>> On Tue, Jan 09, 2007 at 01:44:51PM -0500, temiz wrote:
>>>   
>>>       
>> thank you
>> But I think I need to give you more detail
>>
>> my raster map is actually a geological map and includes so many rock
>> type categories ( over 100).
>>
>> something like this: (of course they are not separete fields)
>> ~~~~~~~~
>> 97      Tkisd         claystone-siltstone-sandstone (rock type )  eocene
>> ~~~~~~~
>> if I want to query my raster map on its rock type. Say,  to display rock
>> group containing claystone. what should I do  ?
>>
>> I can do it on vector map using sql.
>> But I have to stay in raster side. Because I analyse the areas
>> containing claystone and its slope angle higher than 20 deg
>> (another raster map).
>>
>> shortly I need a command  like this:
>> r.mapcalc result="if((@map ~ 'claystone' && slp> 30),1,0))    # regular
>> expression on a text  and this claystone exists
>> in many rock group. So using cat numbers is not practical.
>>
>> I think r.mapcalc makes query on numerical values.
>>
>> so what might be solution be ?
>>
>> regards
>>
>>
>>     
>
> __________________________________________
> Michael Barton, Professor of Anthropology
> School of Human Evolution & Social Change
> Center for Social Dynamics & Complexity
> Arizona State University
>
> phone: 480-965-6213
> fax: 480-965-7671
> www: http://www.public.asu.edu/~cmbarton
>
>
>
>   
thank you

Now by this, it seems to be ok.
~~~~~~~~~
awk '/claystone/ {print ++num_lines,$0}' jeo_cat2.txt > claystone.txt
r.reclass in=bk_jeo2 out=claystone < claystone.txt
~~~~~~~~~

-- 
Ahmet Temiz


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the grass-user mailing list