[GRASS-user] extract by attribute from a dem

hi all,
I have downloaded usgs srtm data from the esdi site in geoTiff format.
I next loaded it in grass and then created a slope map from it.
It shows values are in range from 0 to 86.0636.
next I used r.mapcalc with the expression
r.mapcalc new=if( slopeoriginal<= 20)
to findout all areas which have less than 20 degrees of slope . It returned nothing.
I tried with all values between 20 and 90 , no output ?!?!? atleast values >=87 should have made a copy of the old
dem into the new . Isn’t it ?
can someone help me out.
nishith

Hi,

2007/11/21, nishith datta <nkdiitd2002@gmail.com>:

hi all,
I have downloaded usgs srtm data from the esdi site in geoTiff format.
I next loaded it in grass and then created a slope map from it.
It shows values are in range from 0 to 86.0636.
next I used r.mapcalc with the expression
        r.mapcalc new=if( slopeoriginal<= 20)
to findout all areas which have less than 20 degrees of slope . It returned
nothing.
I tried with all values between 20 and 90 , no output ?!?!? atleast values
>=87 should have made a copy of the old
dem into the new . Isn't it ?
can someone help me out.
nishith

r.mapcalc 'new=if(slopeoriginal <= 20, slopeoriginal, null())'

?

Martin

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

[please cc to grass-user ml...]

2007/11/21, nishith datta <nkdiitd2002@gmail.com>:

thanks for the prompt reply,
sorry it didnot work either ?
any ideas why ?
can I somehow see the data in the raster layer - slope original. I mean the
count of pixels and the categories i.e the slope value against each
category.

in spearfish

$ r.slope.aspect ele=elevation.dem slope=slope

$ r.stats slope nsteps=10 -c --q
0-5.252012 731997
5.252012-10.504024 775215
10.504024-15.756036 545337
15.756036-21.008047 335709
21.008047-26.260059 152262
26.260059-31.512071 56475
31.512071-36.764083 12735
36.764083-42.016095 1251
42.016095-47.268107 117
47.268107-52.520119 9
* 358245

$ r.mapcalc 'new=if( slope <= 20, slope, null())'

$ r.stats new nsteps=10 -c --q
0-1.999213 156159
1.999213-3.998426 346518
3.998426-5.997639 352206
5.997639-7.996851 314379
7.996851-9.996064 277200
9.996064-11.995277 237015
11.995277-13.99449 210267
13.99449-15.993703 178020
15.993703-17.992916 148995
17.992916-19.992128 270
* 748323

may be there is something wrong with the slope map.
Also won't changing 20 to 90 in the expression if(slopeoriginal <= 20,
slopeoriginal, null()) give me the original map again?
thanks
nishith

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

It is also possible that the region was not set to the geographic
coordinates of the dem or slope map when performing the r.mapcalc.
r.slope.aspect is one of the few programs to default to extent and
resolution of the original map, not the current region.

Chuck Ehlschlaeger, Associate Professor of Geography
Western Illinois University
215 Tillman Hall, 1 University Circle, Macomb, IL 61455
cre111@wiu.edu, phone: 309-298-1841, fax: 309-298-3003

-----Original Message-----
From: grass-user-bounces@lists.osgeo.org
[mailto:grass-user-bounces@lists.osgeo.org] On Behalf Of Martin Landa
Sent: Wednesday, November 21, 2007 1:23 PM
To: nishith datta
Cc: GRASS users list
Subject: Re: [GRASS-user] extract by attribute from a dem

[please cc to grass-user ml...]

2007/11/21, nishith datta <nkdiitd2002@gmail.com>:

thanks for the prompt reply,
sorry it didnot work either ?
any ideas why ?
can I somehow see the data in the raster layer - slope original. I mean

the

count of pixels and the categories i.e the slope value against each
category.

in spearfish

$ r.slope.aspect ele=elevation.dem slope=slope

$ r.stats slope nsteps=10 -c --q
0-5.252012 731997
5.252012-10.504024 775215
10.504024-15.756036 545337
15.756036-21.008047 335709
21.008047-26.260059 152262
26.260059-31.512071 56475
31.512071-36.764083 12735
36.764083-42.016095 1251
42.016095-47.268107 117
47.268107-52.520119 9
* 358245

$ r.mapcalc 'new=if( slope <= 20, slope, null())'

$ r.stats new nsteps=10 -c --q
0-1.999213 156159
1.999213-3.998426 346518
3.998426-5.997639 352206
5.997639-7.996851 314379
7.996851-9.996064 277200
9.996064-11.995277 237015
11.995277-13.99449 210267
13.99449-15.993703 178020
15.993703-17.992916 148995
17.992916-19.992128 270
* 748323

may be there is something wrong with the slope map.
Also won't changing 20 to 90 in the expression if(slopeoriginal <= 20,
slopeoriginal, null()) give me the original map again?
thanks
nishith

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.2/1142 - Release Date: 11/20/2007
5:44 PM

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.2/1142 - Release Date: 11/20/2007
5:44 PM

Charles Ehlschlaeger wrote:

It is also possible that the region was not set to the geographic
coordinates of the dem or slope map when performing the r.mapcalc.
r.slope.aspect is one of the few programs to default to extent and
resolution of the original map, not the current region.

i.e. set the region bounds to match the input map before running region obeying
modules like r.mapcalc:

g.region rast=elevation.dem

$ r.slope.aspect ele=elevation.dem slope=slope
$ r.mapcalc 'new=if( slope <= 20, slope, null())'

I am surprised to see a slope of 89deg for SRTM data, that's a big cliff at
SRTM resolution! Even if there is a huge 90deg cliff, from the plan-view cell's
perspective that is only a small sliver in the cell, and to maintain that slope
over the horizonal resolution of the cell means a *huge* vertical distance
change. I work in very steep fjords with 1000m drops, and the most I see at 10m
res is somewhere around 76deg.

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs