I am new to using Xamarin.Forms.
I am trying to create a Basemap by using a local file path to a .tpk file.
var tpkFile = new Uri(@"LocalPath\File.tpk");
ArcGISTiledLayer layer = new ArcGISTiledLayer(tpkFile);
Map = new Map(new Esri.ArcGISRuntime.Mapping.Basemap(layer));
The same process is shared across Xamarin.Forms UWP & a WPF application.
The WPF application loads as expected.
However, the Xamarin.Forms UWP changes the layers LoadStatus to Loading and no further.
Similar, the Map DrawStatus changes to IsProgress and no further.
Why is this?
Can anyone help?
How to you load the file onto the device in iOS?
I am not currently using IOS.
I have created a Shared project across all platforms (UWP, Android, IOS).
Currently only focusing on the Xamarin.Forms.UWP app.
var tpkFile = new Uri(@"C:\Documents\NaturalEarth.tpk");
ArcGISTiledLayer layer = new ArcGISTiledLayer(tpkFile);
Map = new Map(new Esri.ArcGISRuntime.Mapping.Basemap(layer));
WPF app : Shows the TPK file as the Basemap.
UWP app : The MapView remains blank and the LoadStatus remains Loading on the layer.
Hi,
This is a restriction of the UWP 'sandbox' - you will need to take one of the following approaches:
- Include the file with your application
- Prompt the user to browse to a location they give the app permission to access
- Read the file from one of the locations that all UWP apps can access (note you will need to request that capability in your app manifest).
For more information see File access permissions - UWP applications | Microsoft Docs.
Thanks
Mike
Hi,
Thank you for the post.
However, none of which seem to be a solution. I must be missing something.
Projects include:
MyMap.App
MyMap.App.Android
MyMap.App.UWP
MyMap.App includes the following:
MapPage.xaml
MapPageViewModel.cs
The viewmodel is running the following code:
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "NaturalEarth3857.tpk");
ArcGISTiledLayer arcGISTiledLayer = new ArcGISTiledLayer(new Uri(path));
Map = new Map(new Esri.ArcGISRuntime.Mapping.Basemap(arcGISTiledLayer));
Map.LoadStatusChanged += Map_LoadStatusChanged;
Neither UWP or Android complete the load of the file. I have followed the guidance of the link sent by adding documentsLibrary as a capability in the app manifest. But still nothing.
Can you help please?
Cheers,
Shane