Solved! Go to Solution.
The order of features displayed in the popup has produced no small amount of lively discussion. The popup does not show features in layer order, but rather in order of how quickly results are retrieved from the layers. Pretty much everything you'd ever want to know about it is in this thread, which although started back in 2014 continues to the present day. Despite the discussion being in a different context (ArcGIS Online), it's the very same issue.
You can set the popupEnabled property to false for any layer you don't want the popup to appear.
const streetLayer = new FeatureLayer({
url: "https://services6.arcgis.com/Qptn479QktK11k72/arcgis/rest/services/Stsearch/FeatureServer",
definitionExpression: ("Customer_N in ('HW: ERYC Highway Maintained','HW: ERYC Part Maintained')"),
outFields: ["*"],
title: "East Riding maintained road",
renderer: stsRend,
popupEnabled: false
});
Hi Ken
Thanks for the quick response. How do I then get that popup to appear if I click directly on that layer, i.e. I want to log a new pothole issue?
I need the popup for the points (existing pothole issues) to appear if I click directly on them, but the popup for the street layer (log a new pothole) to appear if I click anywhere else (on the line layer).
I'd seen something about graphics drawing order on another post but not sure if that is the issue or how to implement it.
Could you use the same logic used in this post?
The order of features displayed in the popup has produced no small amount of lively discussion. The popup does not show features in layer order, but rather in order of how quickly results are retrieved from the layers. Pretty much everything you'd ever want to know about it is in this thread, which although started back in 2014 continues to the present day. Despite the discussion being in a different context (ArcGIS Online), it's the very same issue.
Hi Joel
Wow, this is my exact query and yes agreed what a lively discussion! Seems sadly there is no sort order other than the fastest to load first wins. I did notice on my popups that before I added the url's to the point features they were loading first (before the line feature popup) and that was exactly what I wanted,
Sounds like no way to set the order (yet) so looks like my only option at the moment is to strip down my point feature popups to get them to win the race and load faster.
Thanks for your pointer on this.
Looks like @LaurenBoyd has a Christmas present that's going to make a lot of people happy this year. According to this page, the popup will display features in layer order starting in 4.29 (expected release in February 2024).
"The Popup and Features widgets now display features from multiple layers in the order they are displayed in the map. This means that the features of the topmost layer in the map will appear first, followed by the features of the next layer, and so on. In previous versions, the features were displayed in the order they were returned from the server."