Loading rasters/mosaic data by query (from image service), caching and show on map them

637
3
12-17-2020 07:49 AM
БелыйАлександр
New Contributor

I am an android developer who uses ArcGis SDK to implement maps. I am having problem with the implementation.

Now I want to download from the server (image  server) specific rasters by query (like here: https://developers.arcgis.com/rest/services-reference/query-image-service-.htm), for example, download satellite images of a specific object for a specific date. I also want to save them locally (cache) and display them on map.

Please tell me, can I do this using Android Runtime SDK and Image Server?

If not, please tell me if there is another solution for my problem.

Thanks

0 Kudos
3 Replies
MarkBaird
Esri Regular Contributor

If your image server has been configured to allow downloads you should be able to download a tile package of the data for viewing offline.

Are you working with the layer directly or is it part of a webmap?

From your question it sounds like you are adding the service to the map yourself, so if this is the case take a look at the section titled "Tiled Layers" in this doc https://developers.arcgis.com/java/latest/guide/take-a-layer-offline.htm

Does this help?

 

0 Kudos
БелыйАлександр
New Contributor

Hello @MarkBaird, thanks for the answer!

I am working with part of a webmap. But i need work with part of the data (with data tables), becouse i need get data by query (for example: all rassters by some object).

I will try to work with tiled layer and load it offline from image server. Would you write plese how i can work with tpk file which i will get localy? 

How i can see in this documentation: https://developers.arcgis.com/android/latest/guide/add-raster-data.htm

I can't add rster from tpk file. Write me please if a can do it with tpk file or if you know other method to link loading tiled offline and adding rasster on the map from local file (tpk or other)

0 Kudos
MarkBaird
Esri Regular Contributor

We might need to take a step back here and review what you are using your data for.  Is the raster data you are using for visualization only, or are you performing raster analysis on it?

You should also note that you can take an entire webmap offline and there is API for achieving this.  This is probably easier than the initial methods I pointed you at which are for taking individual layers offline, although these are what are used in the background.  These workflows are introduced here https://developers.arcgis.com/android/latest/guide/work-offline.htm

If you are still going down the route of taking individual layers offline - hence your image service as a tile package, you should understand that tile packages are for visualization and are not added as rasters.  If you have a tile package you add it using code like this:

// load the tile cache from local storage
TileCache tileCache = new TileCache(getExternalFilesDir(null) + getString(R.string.san_diego_tpk));
// use the tile cache extent to set the view point
tileCache.addDoneLoadingListener(() -> mMapView.setViewpoint(new Viewpoint(tileCache.getFullExtent())));
// create a tiled layer and add it to as the base map
ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tileCache);
mMapView.getMap().setBasemap(new Basemap(tiledLayer));

This is taken from a sample which loads a basemap from a URL: https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java/offline-geocode

 

 

0 Kudos