Commit 8d0e56bd authored by Porter Libby's avatar Porter Libby
Browse files

+ topo and sat view, refactor

parent 58051e47
html, body, #viewDiv{
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#controls{
width: 100px;
margin-left: 12px;
display:block;
position: absolute;
z-index: 10;
top:100px;
left:0;
right:0;
bottom:0;
}
var mapstate = 0;
require([
"esri/Map",
"esri/views/MapView"
], function(Map, MapView) {
var map1 = new Map({
basemap: "topo"
});
var map2 = new Map({
basemap: "satellite"
});
var view = new MapView({
container: "viewDiv",
map: map1,
center: [-118.71511,34.09042],
zoom: 11
});
document.querySelector(".btn_topo").addEventListener("click", function(event) {
if (mapstate != 0){
mapstate = 0;
view.map = map1;
console.log('switch to topo');
}
else {
console.log('already in state 0');
}
});
document.querySelector(".btn_sat").addEventListener("click", function(event) {
if (mapstate != 1){
mapstate = 1;
view.map = map2;
console.log('switch to sat');
}
else {
console.log('already in state 1');
}
});
});
\ No newline at end of file
......@@ -4,34 +4,16 @@
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Datavis 2.0</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" type="text/css" href="css/main.css" />
<link rel="stylesheet" href="https://js.arcgis.com/4.12/esri/css/main.css">
<script src="https://js.arcgis.com/4.12/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView"
], function(Map, MapView) {
var map = new Map({
basemap: "topo-vector"
});
var view = new MapView({
container: "viewDiv",
map: map,
center: [-118.71511,34.09042],
zoom: 11
});
});
</script>
<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<div id="viewDiv"></div>
<div id="controls">
<button class='btn_sat'>Satellite</button>
<button class='btn_topo'>Topography</button>
</div>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment