/
Satellite Imagery in OpenLayers.html
54 lines (48 loc) · 2.53 KB
/
Satellite Imagery in OpenLayers.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<title>Satellite Imagery in OpenLayers - Azure Maps Web SDK Samples</title>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="This sample shows how to render Azure Maps Satellite/Aerial imagery tiles in the OpenLayers map control." />
<meta name="keywords" content="map, gis, API, SDK, raster, imagery, satellite, aerial, tiles, Open Layers, OpenLayers" />
<meta name="author" content="Microsoft Azure Maps" />
<!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
<link rel="stylesheet" href="https://openlayers.org/en/v4.6.5/css/ol.css" type="text/css" />
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
<script src="https://openlayers.org/en/v4.6.5/build/ol.js"></script>
<script type='text/javascript'>
//Add your Azure Maps subscription key to the map SDK. Get an Azure Maps key at https://azure.com/maps
var subscriptionKey = '<Your Azure Maps Key>';
var map;
function GetMap() {
map = new ol.Map({
target: 'myMap',
layers: [
new ol.layer.Tile({
source: new ol.source.XYZ({
url: 'https://atlas.microsoft.com/map/imagery/png?api-version=1&style=satellite&tileSize=256&view=Auto&zoom={z}&x={x}&y={y}' +
'&subscription-key=' + subscriptionKey,
attributions: `© ${new Date().getFullYear()} DigitalGlobe, Microsoft`,
tileSize: 256
})
})
],
view: new ol.View({
center: [0, 0],
zoom: 2
})
});
}
</script>
</head>
<body onload="GetMap()">
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">
<legend>Satellite Imagery in OpenLayers</legend>
This sample shows how to render Azure Maps Satellite/Aerial imagery tiles in the <a href="https://openlayers.org/">OpenLayers map control</a>.
</fieldset>
</body>
</html>