AnsweredAssumed Answered

Popups using MapImageLayer

Question asked by sarojthapa60 on Aug 2, 2017
Latest reply on Aug 2, 2017 by sarojthapa60

I have a map service published through ArcGIS Server. The map service has 3 layers and the layers have sublayers. I am trying to transition from Esri's JSAPI 3.x to 4.x. In 3.x, I used to call a ArcGISDynamicMapServiceLayer and use layer.setInfotemplates to add popups to the map. I have a few layers, so I do not want to use feature layer to create popups for the sake of performance. 

Can I call popups using MapImageLayer in JS API 4.x?

The codes I used in 3.x is as follow:

 

 

var popupTemplate = new PopupTemplate({
  "title": "Row Flags",
  fieldInfos: [
    {fieldName: "GPS_Date", visible: true, label: "Date Collected", format: {dateFormat: "shortDate"}},
    {fieldName: "GNSS_Heigh", visible: true, label: "Z-value"},
    {fieldName: "Feature_Description", visible: true, label: "Description"}
  ]
});
var dynamicLayer = new ArcGISDynamicMapServiceLayer("https://RESTURLEndpoints", {
  "imageParameters": imageParameters,
  opacity: 1
});
dynamicLayer.setInfoTemplates({
  1: {infoTemplate: popupTemplate},
  2: {infoTemplate: popupTemplate2},
  4: {infoTemplate: popupTemplate3},
  5: {infoTemplate: popupTemplate4},
  7: {infoTemplate: popupTemplate5},
  8: {infoTemplate: popupTemplate6},
  9: {infoTemplate: popupTemplate7},
  10: {infoTemplate: popupTemplate8}
});

Thanks,

Outcomes