map2 = {
var map2 = new ol.Map({
view: new ol.View({center: ol.proj.transform([16.9278, 52.4044], 'EPSG:4326', 'EPSG:3857'), zoom: 10}),
layers: [new ol.layer.Tile({
source: new ol.source.OSM()
})],
target: html`<div style='height:500px;'></div>`,
});
var marker = new ol.Feature({
type: 'blueCircle',
geometry: new ol.geom.Point(ol.proj.transform([16.9071388, 52.4901917], 'EPSG:4326', 'EPSG:3857')),
});
var CircleStyle = ol.style.Circle
var {Fill, Icon, Stroke, Style} = ol.style;
var marker2 =
new ol.Feature({
type: 'geoMarkerBlackWhite',
geometry: new ol.geom.Point(ol.proj.transform([16.92, 52.4901917], 'EPSG:4326', 'EPSG:3857')),
});
var marker3 =
new ol.Feature({
type: 'icon',
geometry: new ol.geom.Point(ol.proj.transform([longitude, latitude], 'EPSG:4326', 'EPSG:3857')),
});
var styles = {
'blueCircle': new Style({
image: new CircleStyle({
radius: 7,
stroke: new Stroke({
color: 'blue',
width: 1,
}),
}),
}),
'icon': new Style({
image: new Icon({
anchor: [0.5, 1],
src: 'https://cdn0.iconfinder.com/data/icons/small-n-flat/24/678111-map-marker-64.png',
}),
}),
'geoMarkerBlackWhite': new Style({
image: new CircleStyle({
radius: 7,
fill: new Fill({color: 'black'}),
stroke: new Stroke({
color: 'white',
width: 3,
}),
}),
}),
};
var markers = new ol.source.Vector({
features: [marker, marker2, marker3]
});
var markerVectorLayer = new ol.layer.Vector({
source: markers,
style: function (feature) {
return styles[feature.get('type')];
},
});
map2.addLayer(markerVectorLayer);
setTimeout(() => map2.updateSize(), 1);
return map2
}