Select to view content in your preferred language

Can we add multiple png files as raster layer on mapview? Please suggest some example, if possible.

638
1
10-23-2017 11:50 PM
SurajShrestha
Emerging Contributor

I have multiple raster data in png format on sd card. I want to display them over mapview, so that it can be used in offline too. Read most of documentation, but only seen loading of single raster layer. Is there anyway I could implement this feature?

0 Kudos
1 Reply
AlexanderNohe1
Honored Contributor

Yes.  A list of supported raster formats can be found here:

Add raster data—ArcGIS Runtime SDK for Android | ArcGIS for Developers 

Additionally, if you want to load multiple raster formats, you will need to iteratively invoke the raster layer constructor and then add each layer created to the mapview.  You would want something along the lines of this:

ArrayList<String> paths = new ArrayList();

paths.add("/path/to/first.png");

paths.add("/path/to/second.png");

for (String path : paths) {

      Raster raster = new Raster(rasterFilePath);

      RasterLayer rasterLayer = new RasterLayer(raster);

      mapview.addLayer(rasterLayer);

}

I hope this helps!