[OpenLayers-Users] Problems with labels
adidas
xkadidas at gmail.com
Thu Jun 28 05:20:39 PDT 2012
Hi! Need to display a small title above the markers. The markers are
drawn using poi (php generates text file for poi).
Adding the point this way:
function addPoint(lon,lat,title,ident,layr){
var ttt = new OpenLayers.LonLat(parseFloat(lon), parseFloat(lat));
ttt.transform(new OpenLayers.Projection("EPSG:4326"), new
OpenLayers.Projection("EPSG:900913"));
for (var k = 0; k < layr.features.length; k++) {
if(layr.features[k].attributes.PointId==ident) {
layr.features[k].move(ttt);
layr.features[k].attributes.label=title;
return false;
}
}
var point0 = new OpenLayers.Geometry.Point(parseFloat(lon),
parseFloat(lat));
point0.transform(new OpenLayers.Projection("EPSG:4326"), new
OpenLayers.Projection("EPSG:900913"));
layr.addFeatures(new OpenLayers.Feature.Vector(point0, { label:
title, name: title, PointId: ident }));
}
var stylePoint = new OpenLayers.Style(
{
pointRadius: 5,
strokeColor: "red",
strokeWidth: 2,
fillColor: "lime",
labelYOffset: -16,
label: "ee ${label}",
fontSize: 16
});
var vectorPoint = new OpenLayers.Layer.Vector("Точки",
{
styleMap: new OpenLayers.StyleMap(
{ "default": stylePoint,
"select": { pointRadius: 20}
})
});
map.addLayer(vectorPoint );
addPoint(32.24,48.5,'jjhhn','1',map.layers[6]);
I geting this: http://ge.tt/5vp8jlJ/v/0?c
As can be seen, there is no title (except the standard "ee").
Help me resolve that problem.
Thanks.
More information about the Users
mailing list