Skip to content

Instantly share code, notes, and snippets.

@AlanPew
Created September 5, 2021 15:52
Show Gist options
  • Save AlanPew/c46f39ec307d19fb2142c0deefbc253f to your computer and use it in GitHub Desktop.
Save AlanPew/c46f39ec307d19fb2142c0deefbc253f to your computer and use it in GitHub Desktop.
e s r i test
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>ArcGIS API for JavaScript Tutorials: Add a styled basemap layer</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style> <link rel="stylesheet" href="https://js.arcgis.com/4.20/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.20/"></script>
<script>
require([
"esri/config",
"esri/Map",
"esri/views/MapView",
"esri/Basemap",
"esri/layers/VectorTileLayer",
"esri/layers/TileLayer",
], function(esriConfig,Map, MapView, Basemap, VectorTileLayer, TileLayer) {
esriConfig.apiKey = "YOUR_API_KEY";
const vectorTileLayer = new VectorTileLayer({
portalItem: {
id: "6976148c11bd497d8624206f9ee03e30" // Forest and Parks Canvas
},
opacity: .75
});
const imageTileLayer = new TileLayer({
portalItem: {
id: "1b243539f4514b6ba35e7d995890db1d" // World Hillshade
}
});
const basemap = new Basemap({
baseLayers: [
imageTileLayer,
vectorTileLayer
]
});
// const apikey = YOUR_API_KEY ;
const map = new Map({
basemap: basemap,
});
const view = new MapView({
container: "viewDiv",
map: map,
center: [-100,40],
zoom: 3
});
});
</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