1

I am using the ESRI JS 4.24 API to create a mapping application that pulls in a Map Image Layer that is hosted on ArcGIS Portal. I am having trouble getting attributes to show in my pop-up. I would like to display all attributes in the pop-up, not just a select few.

According to documentation the

outFields: ["*"]

has been replaced with

defaultPopupTemplateEnabled: true

However, I am getting no content in my pop-up at the moment. Here's what I'm looking at currently:

enter image description here

Here is my code currently. Any suggestions?

require([
 "esri/config",
 "esri/WebMap",
 "esri/views/MapView",
 "esri/widgets/AreaMeasurement2D",
 "esri/widgets/Compass",
 "esri/widgets/Home",
 "esri/widgets/LayerList",
 "esri/widgets/ScaleBar",
 "esri/widgets/Search",
 "esri/widgets/BasemapToggle",
 "esri/widgets/Legend",
 "esri/widgets/Expand",
 "esri/core/reactiveUtils",
 "esri/widgets/Popup",
 "esri/Map",
 "esri/layers/MapImageLayer",
 "esri/PopupTemplate",
], function (esriConfig, WebMap, MapView, AreaMeasurement2D,
 Compass, Home, LayerList, ScaleBar, Search, BasemapToggle,
 Legend, Expand, reactiveUtils, Popup, Map, MapImageLayer,
 PopupTemplate) {
 esriConfig.portalUrl = "PORTAL_URL";
 const map = new Map({
 basemap: "gray-vector"
 });
 const view = new MapView({
 map: map,
 container: "viewDiv",
 center: [-95, 40],
 zoom: 4,
 });
 
 
 let layer = new MapImageLayer({
 portalItem: {
 id: "1acc2c72f17f44b0bd47ca31f63c9a95",
 },
 });
 map.add(layer);
 layer.when(() => {
 layer.allSublayers.forEach((sublayer) => {
 sublayer.popupEnabled = true;
 sublayer.popupTemplate = { 
 defaultPopupTemplateEnabled: true, 
 outFields: ["*"], 
 }
 });
});
Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Oct 21, 2022 at 0:54

2 Answers 2

0

MapImageLayer does not support popup. As the documentation states:

MapImageLayer...exporting images instead of features

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html

images do not hold features to be displayed in a popup. You might want to check FeatureLayer instead.

answered Oct 24, 2022 at 6:11
1
  • I am able to get pop-ups. The fields just need to be hard-coded. Commented Nov 9, 2022 at 0:24
0

That's partly incorrect.

The popup is applied to the mapimagelayer sublayers. If you want to use the default popup template, you can do: MPl is a defined mapimagelayer

for (let sublayer of MPl.allSublayers) {
sublayer.popupEnabled = true;
}
Vince
20.5k16 gold badges49 silver badges65 bronze badges
answered Feb 24, 2023 at 1:36

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.