AnsweredAssumed Answered

How to Get TileLayer in 4.3?It's work in 3.20

Question asked by tms2003 on Jun 4, 2017
Latest reply on Jun 19, 2017 by pram.septian

Dear Sir:

I want to load a tilelayer map in 4.3 . my code like this:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Get started with MapView - Create a 2D map</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.3/esri/css/main.css">
<script src="https://js.arcgis.com/4.3/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/TileLayer",
"dojo/domReady!"
], function(Map, MapView,TileLayer){

// URL points to a cached tiled map service hosted on ArcGIS Server
var operationalLayer = new TileLayer({
url: "http://www.digitalcq.com/RemoteRest/services/CQMap_IMG/MapServer"
});
var map = new Map({

});
map.layers.add(operationalLayer);

var view = new MapView({
container: "viewDiv", // Reference to the scene div created in step 5
map: map // Reference to the map object created before the scene
//zoom: 4, // Sets the zoom level based on level of detail (LOD)
//center: [15, 65] // Sets the center point of view in lon/lat
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>

 

it's doesn't work with any error;

But ,this work in 3.20 like this:

map = new Map("map",{

});

var tiled = new ArcGISTiledMapServiceLayer("http://www.digitalcq.com/RemoteRest/services/CQMap_IMG/MapServer");
map.addLayer(tiled);

 

 

Why? and how to change?

 

need u help!

Outcomes