RasterLayer in android sdk

07-22-2015 06:42 AM
New Contributor II

I am trying add raster layer like tiff to the map, and I use the following code:

FileRasterSource rasterSource = new FileRasterSource(file);

final RasterLayer rasterLayer = new RasterLayer(rasterSource);


It works, however once I want to set the layer to fill the veiewport of the map:


It does not work.

And what's more, I found that the map can not be zoom out at a certain scale. I am not sure why.

Tags (1)
0 Kudos
2 Replies
Regular Contributor II

You may want to listen for when the map status has changed, then call setExtent on the mMapView when the raster layer has finished loading. Consider the following...

mMapView.setOnStatusChangedListener(new OnStatusChangedListener() {

   public void onStatusChanged(Object source, STATUS status) {

       if(source instanceof RasterLayer && STATUS.LAYER_LOADED == status){

             mMapView.setExtent(rasterLayer.getExtent(), 2);




0 Kudos
New Contributor II

In fact I am using the listener at the moment, and it does not work as expectd.

1) I can not see the map unless I zoom in the map.

2) The map will disappear once the map scale is smaller than a certain value.

0 Kudos