I tried creating a popup window in map. When I run my program , it gets the basemap and the icons on the map , but not the popup window. Firebug throws this error
Error: Unable to draw graphic (null): Unable to complete operation. | ...usePost,v=h.crossOrigin):A=!!h);g=e.mixin({},g);g._ssl&&(g.url=g.url.replace(/^h... |
/3.11/ (line 871)
Error: Unable to draw graphic (null): Unable to complete operation. | ...usePost,v=h.crossOrigin):A=!!h);g=e.mixin({},g);g._ssl&&(g.url=g.url.replace(/^h... |
To solve this, I tried adding time between the layers, It didn't solve the problem. Below is my code. Please let me know, if I am making any mistake. Thanks!
<!DOCTYPE html><BR /><html><BR /> <head><BR /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><BR /> <!--The viewport meta tag is used to improve the presentation and behavior of the samples<BR /> on iOS devices--><BR /> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"><BR /> <title> Trees Location</title><BR /><SPAN> <link rel="stylesheet" href="</SPAN><A class="jive-link-external-small" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css" rel="nofollow noopener noreferrer" target="_blank">http://js.arcgis.com/3.11/dijit/themes/claro/claro.css</A><SPAN>"></SPAN><BR /><SPAN> <link rel="stylesheet" href="</SPAN><A class="jive-link-external-small" href="http://js.arcgis.com/3.11/esri/css/esri.css" rel="nofollow noopener noreferrer" target="_blank">http://js.arcgis.com/3.11/esri/css/esri.css</A><SPAN>"></SPAN><BR /><SPAN> <script src="</SPAN><A class="jive-link-external-small" href="http://js.arcgis.com/3.11/" rel="nofollow noopener noreferrer" target="_blank">http://js.arcgis.com/3.11/</A><SPAN>"></script></SPAN><BR /> <script><BR /> var map;<BR /> require(["esri/config", "esri/map","esri/dijit/Popup",<BR /> "dojo/dom-construct",<BR /> "esri/dijit/PopupTemplate",<BR /> "esri/layers/FeatureLayer",<BR /> "esri/symbols/SimpleMarkerSymbol",<BR /> "esri/tasks/GeometryService",<BR /> "esri/layers/ArcGISDynamicMapServiceLayer",<BR /> "esri/layers/ArcGISTiledMapServiceLayer", <BR /> "esri/Color",<BR /> "dojo/domReady!"],<BR /> function (esriConfig, Map,Popup,domConstruct, PopupTemplate, FeatureLayer,SimpleMarkerSymbol, GeometryService, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, Color ) {<BR /><BR /><SPAN> esriConfig.defaults.geometryService = new GeometryService("</SPAN><A class="jive-link-external-small" href="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" rel="nofollow noopener noreferrer" target="_blank">http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer</A><SPAN>");</SPAN><BR /> var popupOptions = {<BR /> markerSymbol: new SimpleMarkerSymbol("circle", 32, null,<BR /> new Color([0, 0, 0, 0.25])),<BR /> marginLeft: "20",<BR /> marginTop: "20"<BR /> };<BR /> var popup = new Popup(popupOptions, domConstruct.create("div"));<BR /> map = new Map("map", { <BR /> center: [-76.756, 40.241],<BR /> zoom: 8,<BR /> infoWindow: popup<BR /> }); <BR /> var popupTemplate = new PopupTemplate({<BR /> title: "{address}",<BR /> fieldInfos: [<BR /> {<BR /> fieldName: "Tredonor",<BR /> visible: true,<BR /> label: "Type"<BR /> },<BR /> {<BR /> fieldName: "Trespecies",<BR /> visible: true,<BR /> label: "Type"<BR /> },<BR /> {<BR /> fieldName: "Trevariety",<BR /> visible: true,<BR /> label: "Type"<BR /> }<BR /> ]<BR /> });<BR /><BR /> var customBasemap = new ArcGISTiledMapServiceLayer(<BR /> "");<BR /> map.addLayer(customBasemap); <BR /> /* setTimeout(function(){<BR /> console.log("pausing a few seconds");<BR /> map.addLayer(customBasemap);<BR />},1000); */<BR /> var treeLayer = new ArcGISDynamicMapServiceLayer(<BR /> ""); <BR /> // map.addLayer(treeLayer); <BR /> setTimeout(function(){<BR /> console.log("pausing a few seconds");<BR /> map.addLayer(treeLayer);<BR />},1000);<BR /><BR /> var featureLayer = new FeatureLayer("",<BR /> {<BR /> infoTemplate: popupTemplate,<BR /> outFields: ["Tredonor","Trespecies","Trevariety", "address"]<BR /> });<BR /> featureLayer.setDefinitionExpression("MEMORIAL != ''");<BR /> map.addLayer(featureLayer); <BR />}); <BR /><BR /></script><BR /></head><BR /><body class="claro"><BR /><div align="center"><strong> Trees Listing </strong><hr><BR /><i><a target="_self" href="listingtrees.html">Listing</a> | <a target="_self" href="locationtrees.html">Locations </a></i><BR /></div><BR /><br><BR /><div id="map" ><BR /></div><BR /></body><BR /></html>