Last active
February 17, 2018 01:36
-
-
Save williamscraigm/361915b684e7dcd873042c2bfbe359fa to your computer and use it in GitHub Desktop.
4.x JSAPI vector tile sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> | |
<title>WMTSLayer - 4.x</title> | |
<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css"> | |
<style> | |
html, | |
body, | |
#viewDiv { | |
padding: 0; | |
margin: 0; | |
height: 100%; | |
width: 100%; | |
} | |
.esri-layer-list { | |
width: 310px; | |
} | |
</style> | |
<script src="https://js.arcgis.com/4.6/"></script> | |
<script> | |
var map, view; | |
require([ | |
"esri/config", | |
"esri/Map", | |
"esri/views/MapView", | |
"esri/layers/VectorTileLayer", | |
"esri/widgets/LayerList", | |
"dojo/domReady!" | |
], function( | |
esriConfig, | |
Map, | |
MapView, | |
VectorTileLayer, | |
LayerList | |
) { | |
var layer = new VectorTileLayer({ | |
// URL to the style of vector tiles | |
url: "https://www.arcgis.com/sharing/rest/content/items/ca6e6764d7be43a4b7b40271bc194b52/resources/styles/root.json" | |
}); | |
map = new Map({ | |
layers: [layer] | |
}); | |
view = new MapView({ | |
container: "viewDiv", | |
map: map, | |
center: [-77, 38.9], | |
scale : 18489297.737236 | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="viewDiv"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment