<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-3" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Dear Hamish,<br>
<br>
It definitely helped!<br>
<br>
On 04/03/2010 03:21, Hamish wrote:
<blockquote cite="mid:496045.461.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">Luigi Ponti wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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.)
</pre>
</blockquote>
<pre wrap=""><!---->
(it needs to be explained better in the docs.)
</pre>
<blockquote type="cite">
<pre wrap="">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:
<a class="moz-txt-link-freetext" href="https://docs.google.com/fileview?id=0B0EpsfMZ-IZYNzI2ZjRjMTQtNTNiNi00NTJkLWJlZjAtNzAyN2E0MTM3OWUw&hl=it">https://docs.google.com/fileview?id=0B0EpsfMZ-IZYNzI2ZjRjMTQtNTNiNi00NTJkLWJlZjAtNzAyN2E0MTM3OWUw&hl=it</a>
</pre>
</blockquote>
<pre wrap=""><!---->
nice!
</pre>
</blockquote>
<br>
It is global ecological zones from FAO <a class="moz-txt-link-freetext" href="http://www.fao.org/geonetwork/">http://www.fao.org/geonetwork/</a>
with color scheme from <a class="moz-txt-link-freetext" href="http://colorbrewer2.org/">http://colorbrewer2.org/</a> and underlying shaded
relief from globe relief <a class="moz-txt-link-freetext" href="http://www.ngdc.noaa.gov/mgg/topo/globe.html">http://www.ngdc.noaa.gov/mgg/topo/globe.html</a>
(there is also 10m scale shoreline from
<a class="moz-txt-link-freetext" href="http://www.naturalearthdata.com/">http://www.naturalearthdata.com/</a>).<br>
<br>
I am impressed with ps.map results (never used before): it does look a
lot more like a printed map.<br>
<br>
<blockquote cite="mid:496045.461.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">Any pointer?
</pre>
</blockquote>
<pre wrap=""><!---->
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'
</pre>
</blockquote>
<br>
On my system it needs to be unquoted (at least in my case, where values
were integers) -- I mean, no quotes at all.<br>
<br>
<blockquote cite="mid:496045.461.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">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.
</pre>
</blockquote>
<br>
Yes, it is not smart enough; I had to use fcolor option with R:G:B
triplet in vareas in place of rgbcolumn.<br>
<br>
<blockquote cite="mid:496045.461.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">Set the label to be each zonename.
(easiest way for a few values)
</pre>
</blockquote>
<br>
Thanks: I have gone this way, for now. See link below:<br>
<a class="moz-txt-link-freetext" href="https://docs.google.com/fileview?id=0B0EpsfMZ-IZYYmYwYmRlMWItY2Y4NS00MTNhLWEzZWUtZjQ2Y2U0OTU2YzRi&hl=it">https://docs.google.com/fileview?id=0B0EpsfMZ-IZYYmYwYmRlMWItY2Y4NS00MTNhLWEzZWUtZjQ2Y2U0OTU2YzRi&hl=it</a><br>
<br>
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.)<br>
<br>
<blockquote cite="mid:496045.461.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">
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:
</pre>
</blockquote>
<br>
This is a great example that I need to study a bit more.<br>
<br>
Thanks for your help,<br>
<br>
Luigi<br>
<br>
<blockquote cite="mid:496045.461.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">
(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
</pre>
</blockquote>
<br>
</body>
</html>