How can I use a Basemap offline ?

464
1
06-22-2020 07:16 AM
NathanLe_Granvallet
New Contributor

Hi,

Is it possible to use an OfflineMapTask to download a part of the BasemapTopographic to use it offline ?

I've tried with this example but it uses a PortalItem instead of a BaseMap.

Thanks,

Nathan.

Tags (1)
0 Kudos
1 Reply
LukeSmallwood
Esri Contributor

Hi Nathan. There's a couple of ways you can take your topographic basemap offline - but first let me clarify how you want to use the basemap. Basically it comes down to whether you want to:

  • have the basemap loaded as part of a complete offline map, or
  • have the basemap as an independent data-set on your device that you can re-use in different apps

For the first approach, you would use the OfflineMapTask  to take an entire web map (the Portal Item you mention) offline. That will essentially take all of the layers in the web map (including the basemap) and if they support going offline write them to your device in a directory called a MobileMapPackage. A Runtime app can then later open up that package to display the entire offline map. See this sample for an example of how to do that. 

Note that a MobileMapPackage can either be a single archived file (e.g. with an .mmpk extension) or a directory containing the offline data. If you use the OfflineMapTask it will be a directory - in either case the API to load and use it is the same.

For the second approach you would use the ExportTileCacheTask to take just the basemap offline. You will need to give this task the URL of the basemap layer that you want to take offline. When you take a tiled basemap offline we create a Tile Package (.tpk) on the local device which can then be loaded in a Runtime App using a TileCache instance that you would bind to an ArcGISTileLayer's tileCache property. That tiled layer can then be used in you app as a basemap layer etc.  See this sample for an example of how to do that.

Note that if you want to take a tiled layer offline it must have the "ExportTiles" capability. For ESRI basemaps (such as the Topographic) tiled basemap there are special "for export" versions of the service that are intended for exporting - e.g. World Topographic Map (for Export). You will need to log in to ArcGIS Online to export these services.

Hope that helps,

Luke