Skip to content

Instantly share code, notes, and snippets.

@elbosso
Last active July 26, 2018 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbosso/0db33790a57f79e73a33744c9bedc2e8 to your computer and use it in GitHub Desktop.
Save elbosso/0db33790a57f79e73a33744c9bedc2e8 to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://openlayers.org/en/v4.1.1/css/ol.css" type="text/css">
<style>
.map {
height: 100%;
width: 100%;
}
</style>
<script src="https://openlayers.org/en/v4.1.1/build/ol.js" type="text/javascript"></script>
<title>OpenLayers example</title>
</head>
<body>
<h2>My Map</h2>
<div id="map" class="map"></div>
<script type="text/javascript">
var osmLayerbg = new ol.layer.Tile({
source: new ol.source.OSM({
crossOrigin: null,
url: 'http://osm/osm_tiles_bg/{z}/{x}/{y}.png'
})
});
var hillshadingLayer = new ol.layer.Tile({
source: new ol.source.OSM({
crossOrigin: null,
url: 'http://hillshading/hills_tiles/{z}/{x}/{y}.png'
}),
opacity: 0.8
});
var osmLayerfg = new ol.layer.Tile({
source: new ol.source.OSM({
crossOrigin: null,
url: 'http://osm/osm_tiles_fg/{z}/{x}/{y}.png'
})
});
var map = new ol.Map({
target: 'map',
layers: [
osmLayerbg,
hillshadingLayer,
osmLayerfg
],
view: new ol.View({
center: ol.proj.fromLonLat([11.20, 50.58]),
zoom: 3
})
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment