I try to add a label to a point in open layers. The label is seen but it's somewhere near (0,0) point, not in the given lat, lon point.
var point = new OpenLayers.Geometry.Point(lon,lat);
var label_feature = new OpenLayers.Feature.Vector(point);
label_feature.attributes = {
myLabel: "my label"
};
vector_layer.addFeatures([label_feature]);
Here's the offset values in vector style
labelXOffset: "0",
labelYOffset: "12",
and I get the renderer
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
Thanks
OK, I found a solution:
All you need is to transform point with a projection: