How to download TPK file along with layers in xamarin?

2844
7
01-17-2017 04:29 AM
VinayPrabhakar
New Contributor

Hi All,

I know how to download maps(geodatabase) and basemaps(TPK) seperately.

Now I want to download a map of a particular Extent.

Basicallly i want to downlaod basemap along with the layers but not whole basemap only selected Extent I want to download along with Layers.

0 Kudos
7 Replies
ChadYoder1
Occasional Contributor II

GenerateGeodatabaseParameters and ExportTileCacheParameters allow you to set the map extent for the export.  

GenerateGeodatabaseParameters Class 

And 

ExportTileCacheParameters Class 

0 Kudos
ChadYoder1
Occasional Contributor II

Just to clarify, you can't download a "package" (tile and feature) all at once.  You'll have to get one first, check the result, and then get the other.  Once both are downloaded, this will create the "package" you need to use when offline.

0 Kudos
VinayPrabhakar
New Contributor

can you provide us a sample code??

0 Kudos
ChadYoder1
Occasional Contributor II

Your post stated you knew how to download TPK's, and I shared code for the geodatabase.  Are you just asking how to get the extent?

Using ExportTileCacheParameters, it would be something like, where the mapExtent variable is:

EsriMapView.VisibleArea.Extent

//Create the service for the export
                var tileService = new ArcGISTiledLayer(new Uri (StorageManager.CurrentBasemapUrl));
                if (tileService.LoadStatus != Esri.ArcGISRuntime.LoadStatus.Loaded)
                    await tileService.LoadAsync ();
                
                //Create the export task
                _exportTileTask = await ExportTileCacheTask.CreateAsync(new Uri (StorageManager.CurrentBasemapUrl));

                //Create the export parameters
                _tileParameters = await _exportTileTask.CreateDefaultExportTileCacheParametersAsync (mapExtent,
                    tileService.TileInfo.LevelsOfDetail.ToArray()[0].Scale,
                    tileService.TileInfo.LevelsOfDetail.ToArray()[maxLOD].Scale);

0 Kudos
MaraStoica4
Occasional Contributor

Why not create a mobile map package? 

0 Kudos
ChadYoder1
Occasional Contributor II

I think the issue with a MMPK would be that you couldn't edit and sync the feature data.

0 Kudos
deleted-user-Ohz6rwd1kavx
New Contributor III

I agree with Chad. MMPK data will be read only. If you want to edit data you, you should use GenerateGeodatabase.

Another angle is that the MMPK will only include vector data (I think I'm correct here). If you want a local (aka offline) basemap, you additionally need a TPK.

I'm not 100% on all of this, and therefore happy if someone wants to confirm or correct me on either of the above points.

BTW. I'm using ArcGIS Pro 1.3.1 to create my .mmpk files.

0 Kudos