Dear Hamish,
It definitely helped!
On 04/03/2010 03:21, Hamish wrote:
Luigi Ponti wrote:
I haven't been able to find this in previous discussions
but it seems like a trivial yet impossible (for me) to solve
thing. (Running grass6.4-svn windows standalone installer
win7.)
(it needs to be explained better in the docs.)
I am trying to get a ps.map using an input file like the
following:
[...]
I would like to print a categorical legend with the same
colors as the rgbcolumn, but I only get one gray color that
is different from the RGB_COLOR definitions:
https://docs.google.com/fileview?id=0B0EpsfMZ-IZYNzI2ZjRjMTQtNTNiNi00NTJkLWJlZjAtNzAyN2E0MTM3OWUw&hl=it
nice!
It is global ecological zones from FAO http://www.fao.org/geonetwork/
with color scheme from http://colorbrewer2.org/ and underlying shaded
relief from globe relief http://www.ngdc.noaa.gov/mgg/topo/globe.html
(there is also 10m scale shoreline from http://www.naturalearthdata.com/).
I am impressed with ps.map results (never used before): it does look a
lot more like a printed map.
Any pointer?
the vector legend is by map, not by category. Because you only used the
vareas instruction once, you only get one entry in the vector legend.
two alternatives:
1) add one vareas instruction for every vector zone, and add a
where column_name = 'zonename'
On my system it needs to be unquoted (at least in my case, where values
were integers) -- I mean, no quotes at all.
to each one. You might have to explicitly give the fill color, I don't
think it is smart enough to know that the SQL query only results in 1.
Yes, it is not smart enough; I had to use fcolor option with R:G:B
triplet in vareas in place of rgbcolumn.
Set the label to be each zonename.
(easiest way for a few values)
Thanks: I have gone this way, for now. See link below:
https://docs.google.com/fileview?id=0B0EpsfMZ-IZYYmYwYmRlMWItY2Y4NS00MTNhLWEzZWUtZjQ2Y2U0OTU2YzRi&hl=it
One thing I am not able to do yet, is to use system fonts (e.g. Arial).
I have tried by setting absolute path but it doesn't seem to work. I am
afraid this is more of a postscript question... Is ps.map able to access
and embed GRASS fonts? (ok, tried to get GRASS in.)
2) take the 'v.colors -s' approach, and create a dummy raster map
containing a category file and color table matching what's in the
vector's DB. Then use the colortable command to display it. example:
This is a great example that I need to study a bit more.
Thanks for your help,
Luigi
(this exposes a bug in the ps.map categorical legend though! the fill
colors get rearranged!)
# North Carolina sample dataset
g.copy v=soils_wake,soils_wakeL
# assign soil type ID number to each soil of the 77 soil types
v.db.addcol soils_wakeL col='DSL_NUM integer'
SOIL_TYPES=`v.db.select soils_wake col=DSL_NAME | sort | uniq`
i=0
(
for TYPE in $SOIL_TYPES ; do
i=`expr $i + 1`
echo "UPDATE soils_wakeL SET DSL_NUM=$i WHERE DSL_NAME='$TYPE';"
done
) | db.execute
v.extract in=soils_wakeL out=soils_wakeLc type=area where="DSL_NUM > 70"
d.vect soils_wakeLc type=area -c where="DSL_NUM > 70"
v.colors -s map=soils_wakeLc column=DSL_NUM color=random
d.erase
d.vect soils_wakeLc type=area -a
g.rename vcolors_23877,soils_wakeLc.legend
#create cats file:
v.db.select -c soils_wakeLc columns=DSL_NUM,DSL_NAME fs=":" | \
sort | uniq | r.category soils_wakeLc.legend rules=-
d.legend soils_wakeLc.legend
ps.map in=test.psm out=test.ps && gv test.ps &
#----test.psm
# ps.map input file
border y
color black
width 1
end
raster elevation_shade
vareas soils_wakeLc
rgbcolumn GRASSRGB
label SOIL_CODE
lpos 1
end
#vlegend
# where 5.5 8
# border black
# font arial
# fontsize 12
# cols 1
# end
colortable
where 1 8
raster soils_wakeLc.legend
font arial
fontsize 12
cols 1
nodata Yes
end
end
#----
hope it helps,
Hamish
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user