CartoDB / mobile-sdk

CARTO Mobile SDK core project
https://carto.com/docs/carto-engine/mobile-sdk/
BSD 3-Clause "New" or "Revised" License
184 stars 65 forks source link

Refresh Datasource without Remove and Add the layer #526

Open binu8051 opened 1 year ago

binu8051 commented 1 year ago

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.

mtehver commented 1 year ago

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