On Wed, May 2, 2012 at 6:21 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:
The basin map output from r.watershed is called 'dem.basin'. When I query
a basin I see the easting and northing of the point where I clicked, and a
numeric site_name variable. I've not checked all polygons, but I assume each
is uniquely numbered.
First question: where in the mapset's directory structure is this
site_name variable stored? I've looked in the subdirectories with a
dem.basin file and do not see them.
It is in the cats/ subdirectory. See the second drawing in
http://grass.osgeo.org/programming6/
for the structure.
Converting this raster map to a vector using r.to.vect with an output name
of 'basinv', creates a postgres table with three attribute columns: cat,
value, and label. The latter is blank for all rows. The value column,
however, has the same number repeated for different polygons.
Second question: how are these value numbers created?
They are created if the raster maps has category labels (see
r.category).
North Carolina example.
GRASS 6.4.3svn (nc_spm_08):~ > r.category zipcodes
27511 CARY
27513 CARY
27518 CARY
27529 GARNER
...
GRASS 6.4.3svn (nc_spm_08):~ > g.region rast=zipcodes -p
projection: 99 (Lambert Conformal Conic)
zone: 0
datum: nad83
ellipsoid: a=6378137 es=0.006694380022900787
north: 228500
south: 215000
west: 630000
east: 645000
nsres: 10
ewres: 10
rows: 1350
cols: 1500
cells: 2025000
GRASS 6.4.3svn (nc_spm_08):~ > r.to.vect in=zipcodes out=myzipcodes feature=area
Extracting areas...
...
r.to.vect complete.
GRASS 6.4.3svn (nc_spm_08):~ > v.db.select myzipcodes
cat|value|label
1|27513|CARY
2|27607|RALEIGH
3|27608|RALEIGH
4|27604|RALEIGH
5|27603|RALEIGH
...
Works nicely.
Third question: why are there multiple values for different vector
polygons where there are distinct site_name numeric values in the raster
map?
Maybe too late here, I don't get the last question.
Markus