I'm placing custom markers on a vector layer, but the more downward a coordinates point is from the upper edge of a map, the more the marker shape is offset upwards from that point.
I'm using different map projection (EPSG:5514), so there is probably connection there.
What I need to know is, what to change in my code to center the marker shape on specified coordinates.
Relevant portion of the code:
var stroke = new ol.style.Stroke({color: 'red', width: 1});
var fill = new ol.style.Fill({color: 'red'});
function styleFunction(feature, text) {
feature.displayText = text;
return [
new ol.style.Style({
image: new ol.style.RegularShape({
fill: fill,
stroke: stroke,
points: 3,
radius: 8,
rotation: 0,
angle: 0
}),
text: new ol.style.Text({
font: '14px Calibri,sans-serif',
fill: new ol.style.Fill({ color: markerTextColor }),
stroke: new ol.style.Stroke({
color: textcolor_DKM, width: 1
}),
textAlign: 'left',
offsetX: 10,
offsetY: -2,
text: text
})
})
];
}
var vectorSource = new ol.source.Vector();
var markerVectorLayer = new ol.layer.Vector({
title: 'Notes',
visible: false,
source: vectorSource
});
var feature = new ol.Feature({
geometry: new ol.geom.Point(
ol.proj.fromLonLat([Number(lon), Number(lat)], 'EPSG:5514')
)
});
feature.setStyle(styleFunction(feature, desc));
vectorSource.addFeature(feature);
If you need more info, let me know.