mobile-sdk icon indicating copy to clipboard operation
mobile-sdk copied to clipboard

Refresh Datasource without Remove and Add the layer

Open binu8051 opened this issue 2 years ago • 1 comments

i am using a TileDataSource on a layer RasterTileLayer.

TileDataSource windTileDataSource = new GribTilesMapLayer(projections, MainActivity.this, gribFileTileSource, windselectedtype);
RasterTileLayer windlayer = new RasterTileLayer(windTileDataSource);
mapView.getLayers().add(windlayer);

i load new data to the windTileDataSource and do i need to remove the windlayer everytime and add it again to the mapview? i am doing like this

mapView.getLayers().remove(windlayer);
windlayer = new RasterTileLayer(windTileDataSource);
mapView.getLayers().add(windlayer);

Is there anyway to refresh the datasource other than this method? to acheive a smooth data change on the mapview.

binu8051 avatar Dec 17 '22 13:12 binu8051

Yes, there is a method called notifyTilesChanged in TileDataSource class.

mtehver avatar Dec 22 '22 10:12 mtehver