[GRASS-user] Writing recode rules into a Postgres Database

Moritz Lennert mlennert at club.worldonline.be
Tue Mar 25 09:02:12 EDT 2008


On 06/03/08 23:55, William Hudspeth wrote:
> Hello,
> 
> I would like to explain the problem I am trying to solve. I begin with
> importing a shapefile of county boundaries into a GRASS vector map. I
> then convert the vector map into a raster map using a county ID code in
> the vector map attributes. What I get is a raster map with pixels coded
> into some 30 different county ID categories. I also have a second raster
> map whose pixels are assigned one of a continuous range of floating
> point values (i.e. dust concentration).
> 
> I then use r.average to recode the county map IDs into a new map that
> has counties coded by average dust concentration. When I run r.info I
> get something like this:
> 
> *******
> raster file fips_county2
> 
> generated by r.recode
> recode of raster file fips_county2
> 0:0:0.0000000000
> 35001:35001:5.4066317414
> 35003:35003:5.9971417728
> 35005:35005:3.9597935272
> 35006:35006:7.5931687376
> 35007:35007:5.3254945193
> 35009:35009:0.9088373997
> 35011:35011:2.3610553445
> 35013:35013:21.1810002482
> 
> ********
> 
> The recode rules on each line show that the county ID numbers (e.g.
> 35001) are recoded into average dust concentration values (e.g.
> 5.4066317414).
> 
> I am interested in taking these two pieces of information, county ID and
> average dust concentration, and for each county, appending them as a row
> to a PostgreSQL database table. I have thought of parsing the recode
> files in the hist directories using a scripting language, but would like
> to try something more straightforward. Any ideas?

r.to.vect + v.to.db ?

Moritz


More information about the grass-user mailing list