Hi all
Having a hard time getting access by query to the information included in a Map Image Layer object.
I am trying to work with the following map image layer instance:
http://banedanmark.maps.arcgis.com/home/item.html?id=298233b172c347248080e7e58f06310d
linked to the following URL: http://agis1.cloudapp.net/arcgis/rest/services/BaneGISX_OpenData/Info/MapServer
This instance is displaying several information about the railways in Denmark and includes the following sublayers:
- "Stationer", index 0
- "Kilometermærker", index 1
- "10km", index 2
- "5km", index 3
- "1km", index 4
- "Alle", index 5
- "Strkafs", index 6
These information can be visualized here, among other things: http://banedanmark.maps.arcgis.com/apps/webappviewer/index.html?id=6541fbc0cbba499b861e4d7fe23b10b6
What I want is to display the "Kilometermærker" information (= kilometer marks) and get access to the attributes of the closest ones to, let's say, my current position, which is the center position of my view.
But I am having a hard time retrieving by query the information of the closest kilometer marks. The query does not return any FeatureSet instances and I am not sure why:
- I have no problem handling other Feature Layer instances (like the ones displayed in the previously mentioned link) and getting access to the closest elements with the same method.
- Displaying all the visual information from the map image layer instance by adding it to the map does not present any problems.
- I tried several sublayers from the map image layer object with the same result (no feature set returned).
- I tried to wait for the loading of the view before querying with the same result.
- I tried to create a feature layer from the sublayer with the same result.
- I tried to specify the sublayers to be displayed with the "sublayers" property of the map image layer instance. Still no feature set returned but what I don't understand is that modifying the renderer of the specified sublayer is visible:
var infoMapLayer = new MapImageLayer({
url: "http://agis1.cloudapp.net/arcgis/rest/services/BaneGISX_OpenData/Info/MapServer",
sublayers: [
{
id: 5,
title: "Alle",
renderer: {
type: "simple", // autocasts as new SimpleRenderer()
symbol: {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: "yellow",
size: 10
}
}
}
]
});
There's surely something I did not understand about these map image layers but I can't find out what. Can anybody help me with the issue?
I am attaching to this post the final code.