2

I have to create a web map application with webservices (WMS or WFS).

I use the API for JavaScript of ESRI (4.0) and MapImageLayers for my data. But I didn't find how to add popups (or "popupTemplate"= to a MapImageLayer.

I use this sample for my code (https://developers.arcgis.com/javascript/latest/sample-code/sandbox/sandbox.html?sample=layers-mapimagelayer-sublayers)

  • MapImageLayers is for dynamic ArcGIS services, not for WMS or WFS services. Are you using ArcGIS Server? – Bjorn Svensson Jun 21 '16 at 15:01
  • Hi Bjorn Svensson, yes I am using ArcGIS Server and the webservices that I am using are created with ArcGIS Server Manager and ArcGIS Desktop. – ndidi Jun 21 '16 at 15:18
4

You can use identifyTask to configure the popupTemplate for each sublayer of your MapImageLayer. See the following sample: IdentifyTask JSAPI 4.0

  • Thank you. I tried with the sample changing TileLayer in MapImageLayer with my own web service but it didn't work. I have this error : 'code'TypeError: b is null Trace de la pile : d<._parsedUrlGetter@js.arcgis.com/4.0/esri/tasks/IdentifyTask.js:4:286 .cache["esri/core/accessoireSupport/Properties"]/</a.prototype.get@js.arcgis.com/4.0/:234:320 .cache["esri/core/accessoireSupport/Property"]/</a.prototype.getDescriptor/< ... g() 4.0:160 e/d<() 4.0:160 .cache["dojo/_base/array"]/</d.filter() 4.0:105 e()'code' .I need to add the "PopupTemplate" on the require ? – ndidi Jun 15 '16 at 10:12
0

so far, no way to do it. MapImagerLayer, popupTemplate would not work, ESRI have NOT yet fix this bug,

all I get is empty

identifyTask
                       .execute(params)
                       .then(function(response) {


                         var results = response.results;

                         console.log('identify-results: ', results)


                         return results.map(function(result) {
                                                                var feature = result.feature;
                                                                var layerName = result.layerName;

                                                                feature.attributes.layerName = layerName;



                                                                  feature.popupTemplate = {
                                                                    // autocasts as new PopupTemplate()
                                                                    title: layerName,
                                                                    content: "{*}",
                                                                    outFields: ["*"]
                                                                  };

                                                                return feature;
                         });
                       })
                       .then(showPopup); // Send the array of features to showPopup()

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.