guppista
guppista

Reputation: 13

Change color of graticule label

I'm trying to change the color of graticule labels on my openlayers map but I cant make it work. Here is what I'm doing:

this.Graticule = new OpenLayers.Control.Graticule({
        numPoints: 2,
        labelled: true,
        lineSymbolizer:{strokeColor: "#ffffff", strokeWidth: 1, strokeOpacity: 0.2},
        labelSymbolizer:{strokeColor: "#ffffff", strokeWidth: 1, strokeOpacity: 0.7}
    });

The color lines is changing but I always get black labels.

Can someone help me here?

Thanks.

Upvotes: 1

Views: 858

Answers (2)

anon
anon

Reputation:

In order to change the text labels you need to define font attributes:

labelSymbolizer: {
    fontColor: "#ffffff",
    fontSize: "12px"
}

Upvotes: 3

Henrik Karlsson
Henrik Karlsson

Reputation: 5723

I have no experience with OpenLayers, but from what I've seen that should work. However, I can't get it to work either. An alternative way is to use CSS, for example:

tspan{
    stroke: green;
}

However this will have all labels to be green which probably isn't intended. As I said I have no experience with OpenLayers, but maybe there is some way to lock down the CSS rule to only graticule text?

Upvotes: 0

Related Questions