Rendering labels in GRASS Cartographic Composer from vector layer

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Rendering labels in GRASS Cartographic Composer from vector layer

RichardCooper
Hi,

I'm attempting to add labels from a vector layer column to a map, but so far haven't succeeded.

I've run v.labels to generate a file:

v.label labels=hydrobasins map=hydobasins_asia_vc_chaophraya_vc_vcatadd_vc@hydrolayers column=SUB_NAME type=centroid font=DejaVuSansMono

The file generated is attached:hydrobasins.

I then edit the .psmap that I originally exported from the GRASS Cartographic Composer, adding the following lines:

labels hydrobasins@hydrolayers
    end

NOTE: hydrobasins is located in the hydrolayers MAPSET: /grassdata/hydrology/hydrolayers/paint/labels


When I import the modified .psmap file and click on preview, I'm unable to see the labels?

I'd be grateful for any suggestions as to where I might be going wrong, or if a font issue?

Thanks,
Richard

GRASS 6.4.2
Ubuntu Precise
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

RichardCooper
This post was updated on .
On closer inspection it appears that the labels layer created with v.label will not display in the Map Display.

However, I'm able to display labels from the vector layer by ticking the 'attrcol' option.

Maybe there is an option I need to tick or modify in v.label, but I'd be grateful for any suggestions.

To create the label layer:
v.label map=hydrobasins_africa@hydrolayers column=MAJ_NAME color=red            
Labeled 2355 lines.

NOTE: okay there are too many labels to display and v.label.sa might be more appropriate, but even with the latter I get an empty label layer created (a different issue I don't know, but I'm just trying to get v.label to work first)

To display labels in Map Display:
1. Add vector layer and zoom to selected display
2. Add above labels layer into Layer Manager

--> Labels are not visible?

Here is the generated labels file hydrobasins_africa

System: Mint Linux (Ubuntu Precise), GRASS 6.4.3 RC1
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

RichardCooper
Okay, I found the solution:


the quick answer is try to use the v.label fontsize= option.
set it to 10 or 12 or so.


Ref: http://osgeo-org.1560.x6.nabble.com/how-to-v-label-d-labels-usage-labels-do-not-appear-td3893058.html#a3893070
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

RichardCooper
This post was updated on .
From the above reference:

> (the default) is measured in map units. So in your case it would make the labels sized as 100 meters on the map. If you zoom way out that becomes very tiny and the label disappears. (see also the d.labels min and max options)

If I set a label size in v.label (pts), then this appears to take precedence over the label size setting (in map units). However, if I don't set a label size (in pts), no matter the label size setting (ie., map units), the labels are not displayed. Or is this because my layer is in lat long degrees (which would make sense if applied to creating a projected output map)?
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

RichardCooper
It appears I can set the label size (map units) from the command line and the label re-sizing works as expected (provided I omit the fontsize option). However, I can't seem to omit the fontsize option if running from the module window.


E.g. this works for a lat long layer, input in the command console, where the labels change in size on zooming.
v.label labels=hydro_africa_lables.lbl map=hydrobasins_africa@hydrolayers column=MAJ_NAME size=0.25 color=red
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

Anna Petrášová
Hi,

On Sun, Apr 21, 2013 at 8:27 AM, RichardC <[hidden email]> wrote:
> It appears I can set the label size (map units) from the command line and the
> label re-sizing works as expected (provided I omit the fontsize option).
> However, I can't seem to omit the fontsize option if running from the module
> window.
>

yes, the problem is that after you change the fontsize option in the
dialog, now there is no way to disable it, you have to close it and
open it again. Related ticket 1048 [1].

As for the cartographic composer, labels are not yet supported. I will
try to add it soon. Meanwhile, you can export the instructions file,
add labels instruction there and run ps.map with this file. Do not
forget to change region appropriately (region settings from the
instruction file header).

Anna

[1] http://trac.osgeo.org/grass/ticket/1048



>
> E.g. this works for a lat long layer, input in the command console, where
> the labels change in size on zooming.
> v.label labels=hydro_africa_lables.lbl map=hydrobasins_africa@hydrolayers
> column=MAJ_NAME size=0.25 color=red
>
>
>
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/Rendering-labels-in-GRASS-Cartographic-Composer-from-vector-layer-tp5048403p5048538.html
> Sent from the Grass - Users mailing list archive at Nabble.com.
> _______________________________________________
> grass-user mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

RichardCooper
Hi,

> yes, the problem is that after you change the fontsize option in the
> dialog, now there is no way to disable it, you have to close it and
> open it again. Related ticket 1048 [1].

Thanks.

> As for the cartographic composer, labels are not yet supported. I will
> try to add it soon. Meanwhile, you can export the instructions file,
> add labels instruction there and run ps.map with this file. Do not
> forget to change region appropriately (region settings from the
> instruction file header).

I've tried adding all the contents of the label file directly in to the instruction (.psmap) file and also formatting the latter (as per the ps.map manual) with

labels hydrobasins_5May2013@hydrolayers
    font standard
    end

However, I still can't display the labels in the map composer?

I'd be grateful for any suggestions. Thanks,
Richard
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

hamish-2
Richard wrote:

> I've tried adding all the contents of the label file directly
> in to the instruction (.psmap) file and also formatting the
> latter (as per the ps.map manual) with
>
> labels hydrobasins_5May2013@hydrolayers
>     font standard
>     end
>
> However, I still can't display the labels in the map
> composer?

try getting rid of the 'font standard'.

from the ps.map man page:
"""
font font name
       The  name  of the PostScript font.  Fonts
       present in all PostScript implementations
       are:  Times-Roman,  Times-Italic,  Times-
       Bold, Times-BoldItalic,  Helvetica,  Hel-
       vetica-Oblique,    Helvetica-Bold,   Hel-
       vetica-BoldOblique,   Courier, Courier-
       Oblique,   Courier-Bold,   and Courier-
       BoldOblique.
       The default is Helvetica.
"""

also try using "fontsize 12" or so, the default with v.labels
is to size the font by map units (to allow e.g. small towns to
dissapear as you zoom out), but if you mistake the size setting
for fontsize, you letters are e.g. 12m tall on a grid of many
kilometers..

does the same labels file work ok in an Xmon with 'd.labels'?


Hamish
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

RichardCooper
> does the same labels file work ok in an Xmon with 'd.labels'?

Yes, I can see the labels in the Map Display.

I've run v.labels with font Helvetica and inserted Helvetica in psmap file, and also tried changing fontsize in psmap file.  I also tried with a projected map layer, but still cannot see the labels in  the Map Composer...

Cheers,
Richard
GRASS 6.4.3
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

hamish-2
Richard wrote:
> I've run v.labels with font Helvetica and inserted Helvetica
> in psmap file, and also tried changing fontsize in psmap file.
> I also tried with a projected map layer, but still cannot see
> the labels in the Map Composer...

I think it's simply a matter of the composer not knowing anything
about labels (yet). It still doesn't know about all the things
that the ps.map back-end can do. But you don't need the composer
to render, just run ps.map manually with your .psmap input rules
file.


Hamish
_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

RichardCooper
Thanks Hamish.

Confirming, running ps.map manually* works fine for rendering labels in the map.

Richard

*From Cartographic Composer > File > Launch ps.map dialog > browse to .psmap file etc
Or
File Manager > Command console > run ps.map etc
Reply | Threaded
Open this post in threaded view
|

Re: Rendering labels in GRASS Cartographic Composer from vector layer

Anna Petrášová
In reply to this post by hamish-2



On Sun, May 5, 2013 at 1:01 PM, Hamish <[hidden email]> wrote:
Richard wrote:
> I've run v.labels with font Helvetica and inserted Helvetica
> in psmap file, and also tried changing fontsize in psmap file.
> I also tried with a projected map layer, but still cannot see
> the labels in the Map Composer...

I think it's simply a matter of the composer not knowing anything
about labels (yet). It still doesn't know about all the things
that the ps.map back-end can do. But you don't need the composer
to render, just run ps.map manually with your .psmap input rules
file.

I recently added support for labels in composer in grass 7 (Add
overlays -> Add labels). However I somehow overlooked the font option, so it's not yet supported.

Anna

_______________________________________________
grass-user mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-user