[GRASS-user] upload raster category labels to vector point laye
Moritz Lennert
mlennert at club.worldonline.be
Thu Feb 26 07:45:22 PST 2015
On 26/02/15 15:13, Paulo van Breugel wrote:
> Is there an (easy) way to upload raster category labels to a point file,
> equivalent to uploading category values with v.what.rast?
That would be a nice addition to v.what.rast. Probably worth an
enhancement ticket in trac.
One workaround would be something like this:
g.copy vect=schools_wake,myschools
v.db.addcolumn myschools col="geolcat int"
v.db.addcolumn myschools col="geollabel varchar(4)"
v.what.rast myschools raster=geology_30m column=geolcat
and then a small Python script :
catlabels=grass.read_command('r.category', map='geology_30m').splitlines()
for catlabel in catlabels:
cat=catlabel.split('\t')[0]
label=catlabel.split('\t')[1]
where='geolcat='+cat
grass.run_command('v.db.update', map='myschools', column='geol_code',
value=label, where=where
Moritz
More information about the grass-user
mailing list