1

Want to obtain a job to generate and download a vector tile package and its default style resources by passing the (ExportVectorTilesParameters) to the (ExportVectorTiles) method on the (ExportVectorTilesTask) class. That must also provide a download path to store the vector tile package and its default style resources.

But when I run the (ExportVectorTilesJob) to export and download the vector tile package (.vtpk), it ends up no where.

How can I check and handle the job status that where my job is residing, and what went wrong.

Following is the code I am using to export the vector tiles:

Uri vectorTileLayerUri = vectorTiledLayer.Source;

exportVectorTileTask = await ExportVectorTilesTask.CreateAsync(vectorTileLayerUri);

ExportVectorTilesParameters exportVectorTileParams = await exportVectorTileTask.CreateDefaultExportVectorTilesParametersAsync(
    areaOfInterest: MyMapView.VisibleArea,
    maxScale: MyMapView.MapScale);

string myDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
string tileCachePath = System.IO.Path.Combine(myDocumentsFolder, "VectorMapTiles.vtpk");

ExportVectorTilesJob exportVectorTilesJob = exportVectorTileTask.ExportVectorTiles(exportVectorTileParams, tileCachePath);
exportVectorTilesJob.Start();
Rizwan
  • 103
  • 4
  • 24

1 Answers1

0

You need to wait for the job to complete. It takes the server a little while to generate the data, and then for the runtime to download it. The simplest way is to just await the result:

var result = await exportVectorTilesJob.GetResultAsync();

(If you do this you don't actually need to explicitly start the job) You can also listen for the JobChanged, ProgressChanged and check the Status property to understand how the job is running and provide progress feedback to the user.

dotMorten
  • 1,953
  • 1
  • 14
  • 10