I have been looking at the 'Add Raster' sample and would like to be able to manually add a raster dataset in isolation with no other layers on the map.
When I try doing this the map just displays white. Is this something that should be supported?
All I have done to test this out is take the LocalRasterApp example and removed the lines where the basemap layer is added.
I have tried this and it does not make a difference. One interesting observation is that if I try adding the data in reverse order (raster then tiled basemap) I get the following error
java.lang.RuntimeException: Tiled layer has different spatial reference from the map. at com.esri.map.JMap$b.layerInitializeComplete(Unknown Source) at com.esri.map.Layer.fireLayerCreateCompleteEvent(Unknown Source) at com.esri.map.ArcGISTiledMapServiceLayer$1.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
However I am still only looking to add a raster in isolation but wondered if this would help isolate the issue. I am using the usa_raster for my testing.
What your error message shows is that the local server is reprojecting your image from a different spatial reference when you open the tiled layer first. A tiled layer will not reproject hence the error.
Anyway it's worth starting by saying that your workflow of opening up the raster image on it's own is supported and I can get it to work against 10.2 so we just need to look at what is happening.
In your LayerInitializedCompleteListener, what is the spatial reference of your map? My map is coming out as 4326 so my set Extent method is working fine. I'm however wondering if your blank mpk has been changed so the SR is WGS84. In which case you need to be setting the extent of your map using WGS84 coordinates (lat/long)