[GRASSLIST:5274] Re: get the average slope for a polygon?

Thomas Dewez thomas.dewez at brunel.ac.uk
Sun Jan 5 07:34:46 EST 2003


Hi Jeff,

That sounds really complicated a procedure. How about using 
r.average? You can use the result of your satellite image 
classification directly as a base for the r.average command. No 
worries about vectorizing. 

In your workflow:
1. Classify the satellite image -> class.out
2. r.average base=class.out cover=slope.map out=average.slope

r.clump will give you a unique ID for each classified patch if the 
average was that of the entire classes rather than the average of 
each polygon.

Does this help?

Thomas

> I have been trying to get the average slope for a polygon (actually
> all the polygons) for a vector file created from r.poly from a
> classified satellite image and I've just run out of steam. I've
> exported the slope file (generated from r.slope.aspect) into arc/info
> and converted the grid to points and exported the points (of course
> you have to export the ungenerate file and the attribute file as two
> separate files then link them together after importing them into
> access! ugh). It's the same process as simply:
> 
> r.to.sites -z input=slp30.testshed.rast output=slp30.testshed.site
> s.out.ascii -di sites=slp30.testshed.site fs=, >slope.points.out
> 
> which would have been much better (expect for the ERROR: G_malloc: out
> of memory message I kept getting with GRASS 5.0.0.pre3 on cygwin). I
> then have to read this file in and compute the average slope for each
> of polygons. Is there a way to do this in GRASS?
> 
> And more questions...
> 
> 1) has anyone found decent docs on getting odbc to work with grass
> under cygwin (do we have to use unixodbc or win32 odbc?) 2) what's the
> story on getting "native" multiple attribute support on any version of
> grass 5.0/5.1? 3) is there a version of grass5.0.0 for cygwin yet? not
> one of the pre-release version.
> 
> I would really love to turn arc/info all together but can't just yet.
> keep up the great work.
> 
> Jeff.
> 




More information about the grass-user mailing list