I started following the code sample the Esri provided, but when I run it the map doesn't show up.

This is the link: https://developers.arcgis.com/javascript/latest/sample-code/get-started-mapview/index.html

This is the code:

<!DOCTYPE html>
<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>
  html, body, #viewDiv {
    padding: 0;
    margin: 0;
    height: 100%;
    width: 100%;
<link rel="stylesheet" href="https://js.arcgis.com/4.1/esri/css/main.css">
<script src="https://js.arcgis.com/4.1/"></script>
], function(Map, MapView){
  var map = new Map({
    basemap: "local"
  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
  <div id="viewDiv"></div>

Are you running it off your local machine? Images will not load if you are loading the file via its directory on the machine... e.g. typing C:\Code\map.html into the address bar.

You will need to host the file using a simple web server (python, apache, iis) so that the requests for map tiles are made over http. You can then access your working map through http://localhost:8080/map.html or however you want to set it up.

  • I tried web server tomcate, stil the same probelm – user1798258 Oct 5 '16 at 8:17
  • What does the debugging console in your web browser say? Also, try viewing the network responses and resources for the web tiles. Is NOTHING show up? Is the UI there? – Thomas Oct 5 '16 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.