[OpenLayers-Users] Text markers
Paul Spencer
pagameba at gmail.com
Tue Jun 23 11:55:12 EDT 2009
You can use a vector layer and add point features,
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',
fontColor: '${color}', // this could come from the feature
attributes too ...
pointRadius: 0 // this makes the point (normally a small circle)
invisible
})
);
map.addLayer(textLayer);
var redText = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(x,y), //obviously you need an
appropriate geographic location to add the point
{label: 'My Feature', color: '#F00'} // second parameter is the
feature attributes
);
var blueText = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(x,y), //obviously you need an
appropriate geographic location to add the point
{label: 'Another Feature', color: '#00F'} // second parameter is
the feature attributes
);
textLayer.addFeatures([redText,blueText]);
Cheers
Paul
On 23-Jun-09, at 11:41 AM, VIDAUD Romain wrote:
> Hello,
>
> I am searching a way to display textual markers on my maps instead
> of an icon. Is it possible ?
>
> Thanks,
>
> Romain
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list