[GRASS5] Why does v.label require an x display?
hamish_nospam at yahoo.com
Tue Apr 18 04:33:01 EDT 2006
> I just tried v.label to make a new set of labels and found that it
> won't run unless an x display is open. No need to have anything
> showing in the x display, it just has to be open.
This is only true if you use both the fontsize= and the -a or -c flags
together. (rotate and/or curl labels to align with lines)
It is used to dynamically set the space= option:
space Space between letters for curled labels (in map-units)
> Is this really necessary? If not, can it be changed?
It is needed as fontsize is given in points but positioned using
easting, northing units. When labels are curled along vector lines, each
letter of the label is positioned and rotated individually. If just
rotated along the line we need to know where the center-tie of the text
will be in space. As fixed point size and x,y are totally independent
variables, the current display monitor zoom is used to translate between
the two so it knows how far to spread out the letters and the resulting
text will be readable. If you want curled labels to survive zooming, you
have to use size= to keep everything in map units (zooming issues still
remain as the font size gets tiny or huge in this case -- this is the
reason for the max and min options in d.labels). This is less of an
issue if just using the -a flag, but it still matters.
from the 6.1 help page:
If the fontsize option is given then the space option is determined
automatically from the current display window, otherwise the space
option should be set roughly the same as the size option."
(enough truth in that to cover the case in which it matters)
It's a similar problem trying to scale a 1:50,000 map to the monitor.
Everyone's monitor size and resolution is slightly different, so it
is rather hard for the GIS to translate map units into "1 inch
viewable". We _can_ set scale* in ps.map as we know how big the printed
page will be in earth units. On the monitor we can only guess and, at
least, hope that the X windows settings are roughly correct. e.g.
gpsdrive uses map scale to pick a map, but was written when 800x600 was
popular so is generally wrong today both for hi-res desktops and iPaq
[*] ps.map's scale is still broken for lat/lon locations.
I've modified v.label to skip the dynamic space setting if it was
explicitly given on the command line.
If you can have the GUI figure out the conversion coeff between the
monitor and the ground* (i.e. 1 pixel = xxxxx meters) you can feed a
number to the space= option and the display code will be bypassed.
Something like: space = fontsize * (meters/pixel) is probably
close enough. The problem of each letter being tied to the ground
and overlapping/streching on zoom out/in remains of course.
[*] from "g.region -e" and canvas width?
More information about the grass-dev