I'm very new to programming in general so I apologize for such a basic question. My office would like me to I create an android app that places a map server layer (operational layer) on top of a satellite image base layer. I see examples for adding feature layers and web maps with portal IDs. But not layers from a map server. If I could get a piece of sample code I would be most appreciative.
Solved! Go to Solution.
Code does work if i pull in an ESRI public map server layer. I am going to close this ticket as answered. I believe my issue is with the dev server I'm attempting to pull the map layer from. I'll create another thread for that. Thank you all for the help on this matter.
Hello,
We have a kotlin sample, that adds operational layers(ArcGISMapImageLayer) from the map server to the map with ArcGIS Topographic basemap, which in your case would be ArcGIS Imagery basemap.
https://github.com/Esri/arcgis-runtime-samples-android/tree/main/kotlin/manage-operational-layers
For record keeping: 7/19/23 post by Anonymous User belongs to @PriyankaRupani.
Thank you for showing me this. I'll give it a try.
I wasn't able to get the map server layer to show up. I looked at the sample in GitHub and came up with the following.
This is from the MainActivity file. Any help would be appreciated.
private fun setupMap() {
// create a map with the BasemapStyle topographic
val map = ArcGISMap(BasemapStyle.ArcGISImagery)
// Create an instance of the MapImageLayer and set its URL
val mapImageLayer =
ArcGISMapImageLayer("Map Server URL")
// Add the MapImageLayer to the map
map.operationalLayers.add(mapImageLayer)
// set the viewpoint, Viewpoint(latitude, longitude, scale)
mapView.setViewpoint(Viewpoint(xxxxxx, xxxxxx, 420000.0))
mapView.map = map
If the MAP Server URL you are using, has the layers within it, then you should be able to see those layers, as the code looks fine to me.
once you added the layer to the map operational layer, and assigned the map to mapview,
could you also check if you get the layer back using
val operationalLayers = mapView.map.operationalLayers
do you see any layers under operationalLayers var above?
also, it could be the layer is displaying somewhere on the map, but the viewpoint you're trying to view the layer at is incorrect?
For record keeping: 7/21/23 post by Anonymous User belongs to @PriyankaRupani.
Code does work if i pull in an ESRI public map server layer. I am going to close this ticket as answered. I believe my issue is with the dev server I'm attempting to pull the map layer from. I'll create another thread for that. Thank you all for the help on this matter.