Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
72 lines (60 sloc) 3.25 KB
<!DOCTYPE html>
<html>
<head>
<title>Raster Tiles in ArcGIS JS 4.6 - 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 Raster Tiles in the ArcGIS version 4.6 JavaScript map control." />
<meta name="keywords" content="map, gis, API, SDK, tiles, raster, ArcGIS, ESRI" />
<!-- Add references to the ArcGIS map control JavaScript and CSS files. -->
<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css" type="text/css" />
<script src="https://js.arcgis.com/4.6/"></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>';
require(["esri/config", "esri/layers/WebTileLayer", "esri/Map", "esri/views/MapView", "dojo/dom", "dojo/domReady!"],
function (esriConfig, WebTileLayer, Map, MapView, dom) {
//Add the "atlas.microsoft.com" domain to the cors enabled servers list.
esriConfig.request.corsEnabledServers.push("atlas.microsoft.com");
var map = new Map();
var view = new MapView({
container: "myMap",
map: map
});
//Calculate the level of detail information. Each level has a resolution and scale that is half that of the previous level.
var lods = [
{ level: -1, resolution: 156543.033928, scale: 591657527.591555 }
];
for (var i = 0; i <= 22; i++) {
lods.push({ level: i, resolution: lods[i].resolution * 0.5, scale: lods[i].scale * 0.5 });
}
//Create a tile layer that points to the Azure Maps tiles.
//https://docs.microsoft.com/rest/api/location-based-services/render/getmaptile
var tiledLayer = new WebTileLayer({
urlTemplate: "https://atlas.microsoft.com/map/tile/png?api-version=1&layer=basic&style=main&tileSize=512&view=Auto&zoom={level}&x={col}&y={row}&subscription-key=" + subscriptionKey,
copyright: `© ${new Date().getFullYear()} TomTom, Microsoft`,
tileInfo: {
spatialReference: {
wkid: 3857
},
size: 512,
origin: {
x: -20037508.34,
y: 20037508.34
},
lods: lods
}
});
map.add(tiledLayer);
});
</script>
</head>
<body>
<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>Raster Tiles in ArcGIS JS 4.6</legend>
This sample shows how to render Azure Maps Raster Tiles in the ArcGIS version 4.6 JavaScript map control.
</fieldset>
</body>
</html>
You can’t perform that action at this time.