Fix map using OpenLayers 4.3.3

This commit is contained in:
Vidir Valberg Gudmundsson 2017-09-25 00:54:47 +02:00
parent e938723986
commit f791f00b55

View file

@ -129,26 +129,44 @@
var lat = 55.6886382; var lat = 55.6886382;
var lon = 12.5618443; var lon = 12.5618443;
var zoom = 18; var zoom = 18;
var position = ol.proj.fromLonLat([lon, lat]);
var positionFeature = new ol.Feature({
type: 'geoMarker',
geometry: new ol.geom.Point(position)
});
var fromProjection = new ol.Projection("EPSG:4326"); // Transform from WGS 1984 var map = new ol.Map({
var toProjection = new ol.Projection("EPSG:900913"); // to Spherical Mercator Projection target: 'Map',
var position = new ol.LonLat(lon, lat).transform( fromProjection, toProjection); layers: [
new ol.layer.Tile({
map = new ol.Map("Map"); source: new ol.source.OSM()
var mapnik = new ol.Layer.OSM(); }),
map.addLayer(mapnik); new ol.layer.Vector({
source: new ol.source.Vector({
var markers = new ol.Layer.Markers( "Markers" ); features: [positionFeature]
map.addLayer(markers); }),
markers.addMarker(new ol.Marker(position)); style: new ol.style.Style({
image: new ol.style.Circle({
map.setCenter(position, zoom); fill: new ol.style.Fill({
color: 'rgba(255,0,0,0.8)'
}),
radius: 10
})
})
})
],
view: new ol.View({
center: position,
zoom: zoom
}),
interactions: [], // No dragging or other funny biz
});
</script> </script>
<p> <p>
<address> <address>
<strong>{{ site.data.strings[section_where_address] }}</strong><br /> <strong>{{ site.data.strings[section_where_address] }}</strong><br />
<a href="https://www.ms.dk/mellemrummet">Mellemrummet</a><br /> <a href="https://www.ms.dk/mellemrummet">Cafe Mellemrummet</a><br />
Ravnsborggade 11<br /> Ravnsborggade 11<br />
2200 København Nørrebro 2200 København Nørrebro
</address> </address>
@ -184,6 +202,5 @@
</div> </div>
</footer> </footer>
<script src="js/bootstrap.min.js"></script>
</body> </body>
</html> </html>