[GRASS-user] Ps.map vlegend

Hello.

When using "area fill patterns" (http://grass.osgeo.org/wiki/AreaFillPatterns#Example_Pattern_files) together with vlegend in ps.map trouble appears when customising the patterns to my need. You can pretty much get the patterns you desire with the aid of pwith and scale option, but the problem is that vlegend does not follow up. Vlegend somewhat scales things down making the legend lock like something else than what is seen in the map. One can change the size of the legend by using width and fontsize but the pattern will still have the same size.

Is there any solution to this problem other than generating your own legend?

Martin

Martin Album Ytre-Eide wrote:

When using "area fill patterns" (http://grass.osgeo.org/wiki/AreaFillPatterns#Example_Pattern_files)
together with vlegend in ps.map trouble appears when
customising the patterns to my need. You can pretty much get
the patterns you desire with the aid of pwith and scale
option, but the problem is that vlegend does not follow up.
Vlegend somewhat scales things down making the legend lock
like something else than what is seen in the map. One can
change the size of the legend by using width and fontsize
but the pattern will still have the same size.

Is there any solution to this problem other than generating
your own legend?

Hi,

please file it as a wish/bug in the trac system. I might not be
able to look at it for a few weeks, but don't want it to get
forgotten about.
I've seen something like this before and I figured out a fix for
it, but I'll have to remind myself how I did that.

thanks,
Hamish

I started making my own legend, but I can't seem to make one with pattern :frowning: The rectangle function does not accept a pat command. Any workaround or ideas?

Thanks,

Martin

-----Opprinnelig melding-----
Fra: Hamish [mailto:hamish_b@yahoo.com]
Sendt: 3. mars 2011 02:29
Til: grass-user@lists.osgeo.org; Martin Album Ytre-Eide
Emne: Re: [GRASS-user] Ps.map vlegend

Martin Album Ytre-Eide wrote:

When using "area fill patterns"
(http://grass.osgeo.org/wiki/AreaFillPatterns#Example_Pattern_files)
together with vlegend in ps.map trouble appears when customising the
patterns to my need. You can pretty much get the patterns you desire
with the aid of pwith and scale option, but the problem is that
vlegend does not follow up.
Vlegend somewhat scales things down making the legend lock like
something else than what is seen in the map. One can change the size
of the legend by using width and fontsize but the pattern will still
have the same size.

Is there any solution to this problem other than generating your own
legend?

Hi,

please file it as a wish/bug in the trac system. I might not be able to look at it for a few weeks, but don't want it to get forgotten about.
I've seen something like this before and I figured out a fix for it, but I'll have to remind myself how I did that.

thanks,
Hamish

Martin Album Ytre-Eide wrote:

I started making my own legend, but I
can't seem to make one with pattern :frowning: The rectangle
function does not accept a pat command. Any workaround or
ideas?

one idea: try adding clone vareas, but with smaller pwidth and
an impossible SQL where clause so nothing is ever drawn to the
map. Then use those mini-patterns in the vlegend.
Use 'lpos 0' for the real areas so that they don't get added
to the legend.

if you are comfortable tweaking and recompiling C code there are
other options...

Index: ps/ps.map/ps_vlegend.c

--- ps/ps.map/ps_vlegend.c (revision 45422)
+++ ps/ps.map/ps_vlegend.c (working copy)
@@ -204,7 +204,7 @@
                            fprintf(PS.fp, " %f %f scale\n", sc, sc);
                            set_ps_color(&(vector.layer[i].fcolor));
                            fprintf(PS.fp, " %.8f W\n",
- vector.layer[i].pwidth);
+ vector.layer[i].pwidth * 0.8);
                            fprintf(PS.fp, " %s\n", pat);
                            fprintf(PS.fp, " end\n");
                            fprintf(PS.fp, " } bind\n>>\n");

Hamish

Hamish wrote:

one idea: try adding clone vareas, but with smaller pwidth

sorry, use scale*2 with that, not pwidth (pattern line width)

and an impossible SQL where clause so nothing is ever drawn to
the map. Then use those mini-patterns in the vlegend.
Use 'lpos 0' for the real areas so that they don't get
added to the legend.

if you are comfortable tweaking and recompiling C code
there are other options...

the patch I posted was wrong, this one will remove the probably-too much
pattern shrinking in the vector legend:

Index: ps/ps.map/ps_vlegend.c

--- ps/ps.map/ps_vlegend.c (revision 45422)
+++ ps/ps.map/ps_vlegend.c (working copy)
@@ -186,7 +186,7 @@
                        !(color_none(&vector.layer[i].fcolor))) {

                        if (vector.layer[i].pat != NULL) { /* use pattern */
- sc = 0.5 * vector.layer[i].scale; /* half scale */
+ sc = vector.layer[i].scale;

                            /* load pattern */
                            eps_bbox(vector.layer[i].pat, &llx, &lly, &urx,

Hamish

ps- often patterns look a lot better when it's actually printed, even
when it looks bad on screen.