Skip to content

Instantly share code, notes, and snippets.

@AlanPew
Created September 5, 2021 15:53
Show Gist options
  • Save AlanPew/48bf25c0827f5a6c379381251b74fb49 to your computer and use it in GitHub Desktop.
Save AlanPew/48bf25c0827f5a6c379381251b74fb49 to your computer and use it in GitHub Desktop.
esri js test
<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"
], function (esriConfig,Map, MapView) {
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
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment