JSFiddle - React, Tailwind, and code Playground
by christianspecht
HTML
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/css/ol.css" type="text/css">
<style>
.map {
height: 2000px;
width: 1600px;
}
</style>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.1.3/build/ol.js" type="text/javascript"></script>
<title>Example Map</title>
</head>
<body>
<div id="map" class="map"></div>
<script type="text/javascript">
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Markers:
var vectorSource1 = new ol.source.Vector({});
var iconStyle1 = new ol.style.Style({
image: new ol.style.Icon(({
src: 'https://sindorf-troedelt.de/img/marker1b.png'
}))
});
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Adresses;
var iconA = new ol.Feature({
geometry: new
ol.geom.Point(ol.proj.transform([6.6796, 50.9082], 'EPSG:4326', 'EPSG:3857'))
});
vectorSource1.addFeature(iconA);
var iconB = new ol.Feature({
geometry: new
ol.geom.Point(ol.proj.transform([6.6682, 50.9119], 'EPSG:4326', 'EPSG:3857'))
});
vectorSource1.addFeature(iconB);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// create layers:
var vectorLayer1 = new ol.layer.Vector({
source: vectorSource1,
style: iconStyle1
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
,vectorLayer1
],
view: new ol.View({
center: ol.proj.fromLonLat([6.674573,50.904049]),
zoom: 16
})
});
...