AnsweredAssumed Answered

Javascript API initializes web map with one undesired graphic

Question asked by plinio on Feb 23, 2016
Latest reply on Feb 23, 2016 by processing...

I just realized that a webmap will always be initialized with one graphic and I can't figure out the reazon for it.

Is it a bug? If not, can someone explain to me why that graphic has been added?

 

I copied below a sample code to test this observation:

(taken from Build a web map using ArcGIS.com | Guide | ArcGIS API for JavaScript)

<!DOCTYPE html> <html> <head> <title>Create a Web Map</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge">  <link rel="stylesheet" type="text/css" href="https://js.arcgis.com/3.15/esri/css/esri.css"> <style>   html,body,#mapDiv,.map.container{     padding:0;     margin:0;     height:100%;   } </style>  <script>var dojoConfig = { parseOnLoad:true };</script> <script src="https://js.arcgis.com/3.15compact/"></script> <script>   var map;   require([   "esri/map",   "esri/arcgis/utils",   "dojo/domReady!"   ], function(Map, arcgisUtils){     arcgisUtils.createMap('1a40fa5cc1ab4569b79f45444d728067', "mapDiv").then(function (response) {       map = response.map;     });   }); </script> </head>  <body>   <div id="mapDiv"></div> </body> </html>

 

Then, just open a web developer tool and inspects the objec map.graphics.graphics:

map.graphics.graphics [Object] map.graphics.graphics.length 1 map.graphics.graphics[0].geometry Object {type: "point", x: 0, y: 0, spatialReference: Object}

Outcomes