[GRASS-user] Labels On Maps

Michael Barton michael.barton at asu.edu
Mon Jan 4 09:49:25 EST 2010

On Jan 4, 2010, at 7:11 AM, grass-user-request at lists.osgeo.org wrote:

> Date: Sun, 3 Jan 2010 10:35:54 -0800 (PST)
> From: Rich Shepard <rshepard at appl-ecosys.com>
> Subject: Re: [GRASS-user] Labels On Maps
> To: grass-users at lists.osgeo.org
> Message-ID: <alpine.LNX.2.00.1001031018070.9452 at salmo.appl-ecosys.com>
> Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
> On Sat, 2 Jan 2010, Hamish wrote:
>> you should use the v.label module if you want advanced placement control.
>> it is one case when you are encouraged to hack the x,y offsets in the
>> $MAPSET/paint/labels/ text file by hand. It goes well with unix power-
>> tools. Use d.labels + d.redraw while tweaking the labels file in a text
>> editor in another window.
>> for automatic overlap conflict-resolution you can try the v.label.sa
>> module.
> Hamish,
>   v.label.sa works just fine for labeling the project-specific points of
> interest. Thank you.
>   Now I need to find the way to place a label without reference to a
> specific table and attribute column. d.label displays the labels created
> with v.label[.sa], and displays _all_ stream names visible in the region.
> This would not normally be an issue, but within the one basin, each
> tributary is given the same name as the main creek, and all I want is a
> single label I can place along the mainstem of the drainage.


You can also do interactive label placement in the GUI, another thing it's good for. In the older TclTk GUI (GRASS 6.4 and earlier), it provides an interface to d.text with font selection and optional mouse placement (you can also use screen coordinates). 

In the new wxPython GUI (6.4 and above), the GUI provides a text layer on top of the map. You can create multiple text objects, set their font, size, rotation, and drag them to where you want them.


>   d.text seems to be the appropriate module, but I've bumped into an
> interesting situation with it. Here's the command:
> d.text text="Abernethy Creek" size=2 color=blue bgcolor=white at=50,70 \
>     align=lr rotation=-45 font=DejaVuSerif-Bold
>   The above displays the creek name in blue, rotated, and the background
> rectangle in white, horizontal, and outside the string itself. Yet, when I
> remove the bgcolor= option, the text does not display. Check mate.
>   How can I get either 1) the background color box to match the alignment
> and rotation of the text or b) leave the background color box off while
> allowing the text to display?
> Rich

More information about the grass-user mailing list