Hey,
I am aware of Paul's code. But it is a snippet. You need a bit more to make it
work. The symbolizer you are using has fill: true, but no fillColor. This is
the reason for your problem.
Our examples suggest that you extend one of the symbolizers from
OpenLayers.Feature.Vector.style, to make sure that all required symbolizer
properties are provided.
Regards,
Andreas.
On Sep 21, 2010, at 17:02 , Arto Vuorela wrote:
>
> Not my code but Paul Spencer's. View the mail in its context, using the
> link... Or here my version. Thanks.
>
> var textLayer = new OpenLayers.Layer.Vector('text', {
> style: new OpenLayers.Style({
> label: '${label}', // this gets the value of the text
> from the label
> attribute of each feature
> fontFamily: 'Arial',
> fontSize: '12px',
> fill: 'true', graphic: 'false',
> labelXOffset: '${dX}', labelYOffset: '${dY}', // New
> attributes for the
> style
> fontColor: '#001', // this could come from the feature
> attributes too ...
> pointRadius: 0 // this makes the point (normally a
> small circle)
> invisible
> }) // Style has been defined
> }); // Here one more } than in the original example given.
> map.addLayer(textLayer);
>
> //alert(OpenLayers.Number.format(lontick, 0,"")+"mE"); This works OK.
> // Ref. http://trac.openlayers.org/ticket/1895,
> http://dev.openlayers.org/docs/files/OpenLayers/BaseTypes-js.html#OpenLayers.Number.format
>
> var NorthText = new OpenLayers.Feature.Vector(
> new OpenLayers.Geometry.Point(lontick+0.,lattick+0.), //Northing
> coordinate value on the top of the tick
> {label: OpenLayers.Number.format(lontick, 0,"")+"mE", dX:0,
> dY:50}, null
> // feature attributes as the second parameter
> );
> textLayer.addFeatures([NorthText]); // Label placed.
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Text-markers-tp3143260p5555135.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users