Last active
September 5, 2021 16:14
-
-
Save AlanPew/516c6d72951a96a4a4f842071819222b to your computer and use it in GitHub Desktop.
esri js test 2
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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> | |
<title>ArcGIS Developer Guide: Display a map (2D)</title> | |
<style> | |
html, | |
body, | |
#viewDiv { | |
padding: 0; | |
margin: 0; | |
height: 100%; | |
width: 100%; | |
} | |
</style> | |
<link rel="stylesheet" href="https://js.arcgis.com/4.19/esri/themes/light/main.css"> | |
<script src="https://js.arcgis.com/4.19/"></script> | |
<script> | |
require([ | |
"esri/config", | |
"esri/Map", | |
"esri/views/MapView", | |
"esri/views/SceneView", | |
"esri/layers/Layer" | |
], function (esriConfig,Map, MapView,SceneView,Layer) { | |
esriConfig.apiKey = "AAPK40227465b1fb4bb09182247cf1beb820xRhOp5k4k_gXM_rcN7UzsO-jpL9fDVFJxl1mW-2VUfNv0yCL81xh5yd7ydX-xIJd"; | |
const map = new Map({ | |
basemap: "arcgis-topographic" // Basemap layer | |
}); | |
const view = new MapView({ | |
map: map, | |
center: [-118.805, 34.027], | |
zoom: 13, // scale: 72223.819286 | |
container: "viewDiv", | |
constraints: { | |
snapToZoom: false | |
} | |
}); | |
Layer.fromPortalItem({ | |
portalItem: { | |
id: "f33a34de3a294590ab48f246e99958c9" | |
} | |
}).then(function(layer) { | |
// Adds layer to the map | |
map.add(layer); | |
}); | |
}); | |
</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