AnsweredAssumed Answered

Adding Popups to an ArcGISDynamicMapLayer

Question asked by gsalvador0 on Aug 30, 2017
Latest reply on Aug 30, 2017 by rscheitlin

Hi all,

 

I am trying to add a popup to an ArcGISDynamicMapLayer, and I am a little stuck. I can't get the popups to appear, but I'm not getting any errors in the console. I think the error might be when I try to add the intoTemplate to the layer, but I'm not sure. Here is my code: (I've edited it out extra widgets so it is shorter, but I left the requires and declarations)

require([
"esri/map",
"esri/arcgis/utils",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/dijit/LayerList",
"esri/dijit/BasemapGallery",
"esri/dijit/Popup",
"esri/dijit/PopupTemplate",
"dojo/parser",
"dojo/dom-construct",
"dojo/on",
"esri/InfoTemplate",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dojox/layout/ExpandoPane",
"dojo/domReady!"
], function (Map, arcgisUtils,
ArcGISDynamicMapServiceLayer,
LayerList, BasemapGallery,
Popup, PopupTemplate,
parser, domConstruct, on, InfoTemplate) {
var popup = new Popup({}, domConstruct.create("div"));
var map = new Map("map", {
basemap: "topo",
center: [-98.40, 29.67], //centers on san antonio
zoom: 11, //zooms to all of bexar county, must be integer
infoWindow: popup
});
BCADParcelPopup = new InfoTemplate("2016 BCAD Parcels", "");
var infoTemplates = {
infoTemplate: BCADParcelPopup,
layerUrl: url + "/40" //sudocode, i actually have the url as a string here.
};
var landLayer = new ArcGISDynamicMapServiceLayer(
url,
{
"id": "Land"
});
landLayer.setImageFormat("png32");
landLayer.setInfoTemplates({ infoTemplates });
map.addLayer(landLayer);
});

Outcomes