your mail

Malcolm Williamson malcolm at cast.uark.edu
Tue Feb 4 12:48:26 EST 1997


On Tue, 4 Feb 1997, Kathy Burroughs wrote:

> Hi Everyone,
> 
> I hope you have a simple answer to my hopefully simple question.  I have a
> file with around 1000 polygons.  I need to have displayed or selected only
> those polygons that are less than 1544 acres.  This file exists in vector
> and raster format.  What command in GRASS would be used to accomplish this?
> I am running GRASS 4.13 on a Sun Sparc 10.   Thanks to anyone who can help.
> 
> kathy at nrcsga.ga.nrcs.usda.gov
> 
Hi, Kathy
In the raster realm (where GRASS has all of its power), you can create a 
reclass file to reclass the polygons by their area by running something 
like the following command:

r.stats -az in=allfld | awk '{ acre=$2 * 0.000247 ; printf("%d = %d\n", 
$1, acre) }' > reclass_rules

(all of the above should be entered on one line)

Then, use it with r.reclass:

r.reclass i=polygon_file o=polygon_areas < reclass_rules

Last, use r.mapcalc to find your polygons under 1544 acres:

r.mapcalc small_areas='if(polygon_areas<=1544, polygon_areas)'

Voila!

Please double-check my square-meter to acres conversion in the awk command.
	-Malcolm
--
Malcolm D. Williamson - GIS Specialist           E-mail: malcolm at cast.uark.edu
Center for Advanced Spatial Technologies      Telephone: (501) 575-6159
Ozark Rm. 12                                        Fax: (501) 575-5218 
University of Arkansas              
Fayetteville, AR 72701



More information about the grass-user mailing list