[GRASS-user] Label difficulties

Hamish hamish_nospam at yahoo.com
Tue Aug 28 00:39:47 EDT 2007

Adam Dershowitz wrote:
> I am trying to work with a map that has multi-line vector labels,  
> over a raster basemap.  I have tried it a few different ways and run  
> into different problems with each.
> I am using the 6.3 binary by William Kyngesburye on  Mac.
> First I just tried adding the two characters "\n" to the labels, then  
> ran v.label.
> If I then add a raster label layer it does go over several lines, and  
> all looks correct.  The problem is when I try to save it to jpg and  
> print it that the text is too "pixelated" and looks terrible (also  
> looks the same if I save it to a pdf).  I tried changing the  
> resolution with g.region, but it did not seem to have any effect.   
> The current region is set to the resolution of the actual raster  
> basemap, so maybe that is why?

My guess is that the crummy looking fonts is the result of a limitation
in the PS driver, although Michael might be able to confirm that. If it's
worth anything, the PNG driver actually makes the fonts look nicer than
on the xmon displays. (GUI canvas has the nice version)

What save display as.. JPEG format did you use? 95%? does the JPEG look
ok on the screen but it not print nicely?

Worst case you could take a screenshot of what you see in the display
window and clean that up using Gimp or your favorite paint program.

> Next I tried adding a postscript label layer instead.  That layer  
> looks good on the screen and when saved to a PDF, in terms of the  
> resolution.  The problem is that the "\n" in the text is showing up  
> explicitly, as those two characters, rather then causing a new line  
> in the labels.  So the labels have these extra characters and break  
> in odd places.  This is the case both when viewing this layer in the  
> Map display and the saved version.

My guess is that is an oversight in that tool which hasn't been
programmed in yet. '\n' should be processed by it into a newline.

It's in gui/tcltk/gis.m/maplabels.tcl  ~ line 433:
proc GmCLabels::display {}
	"text" {
		set opt($id,1,ltxt) $val

maybe a way to process the text string with formatting codes to newlines
automatically? (tcl is string friendly, so search and replace shouldn't
can't be too hard, although I've no idea how)

% set a {1\n2}
% set a "1\n2"

Probably the linewrap and border box code in there needs updating too.

> So my main question is how can I get good quality multi-line labels  
> to a saved file?  Is there a way to cause the font resolution to be  
> higher in my raster layer?  Is there a way to get a vector layer to  
> break across multiple lines where I want?  Is there some other  
> solution that I am missing?

You might try ps.map or d.* commands directly on the command line, they
might not be as user friendly as the GUI, but they are more mature and
IM(biased)O ps.map creates the best looking output.


More information about the grass-user mailing list