OfflineMapPackage Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the map data for a particular geographical region. The data can be downloaded and used offline.
public ref class OfflineMapPackage sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 262144)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class OfflineMapPackage final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 262144)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class OfflineMapPackage
Public NotInheritable Class OfflineMapPackage
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 Creators Update (introduced in 10.0.15063.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v4.0)
|
Examples
The following example finds a map packages by using a geographical location. If the map package has not been previously downloaded to the local system, this code asynchronously downloads that map.
Note
The points near a border or large boxes and circles might return multiple map package matches.
private async Task getMapPackages()
{
Geopoint myPoint = new Geopoint(new BasicGeoposition()
{
//Geopoint for Seattle
Latitude = 47.604,
Longitude = -122.329
});
var queryResult = await OfflineMapPackage.FindPackagesAsync(myPoint);
if (queryResult.Status == OfflineMapPackageQueryStatus.Success)
{
foreach (OfflineMapPackage package in queryResult.Packages)
{
if (package.Status != OfflineMapPackageStatus.Downloaded)
{
var downloadRequestResult = await package.RequestStartDownloadAsync();
if (downloadRequestResult.Status == OfflineMapPackageStartDownloadStatus.Success)
{
// do something with the offline map package.
}
}
}
}
}
Remarks
Important
Bing Maps for Enterprise service retirement
The UWP MapControl and map services from the Windows.Services.Maps namespaces rely on Bing Maps. Bing Maps for Enterprise is deprecated and will be retired, at which point the MapControl and services will no longer receive data.
For more information, see the Bing Maps Developer Center and Bing Maps documentation.
Use this class to asynchronously find map packages that you are interested in using offline. You can check the status of packages to determine whether those packages exist on your local system. If they do not, you can asynchronously download them to your system.
You can then access that data in system controls such as the MapControl, and from other objects in the Windows.Services.Maps namespace.
Important
Using this class requires the Offline Maps Management
capability (see App capability declarations).
Properties
DisplayName |
Gets the display name of a geographic location for the offline map package. |
EnclosingRegionName |
Gets the surrounding or containing region of the offline map package (for example: USA). |
EstimatedSizeInBytes |
Gets the estimated size in bytes of the offline map package. |
Status |
Gets the status of a map package (For example, whether the package is downloaded to your local system or not). |
Methods
FindPackagesAsync(Geopoint) |
Starts an asynchronous operation to find a map package that contains map data for specified geographical location. |
FindPackagesInBoundingBoxAsync(GeoboundingBox) |
Starts an asynchronous operation to find a map package that contains map data for specified four-sided geographic area. |
FindPackagesInGeocircleAsync(Geocircle) |
Starts an asynchronous operation to find a map package that contains map data for specified geographic area. |
RequestStartDownloadAsync() |
Starts an asynchronous operation to request the download of a map package to your local system. |
Events
StatusChanged |
Occurs when the status of an OfflineMapPackageQueryResult changes. |