createDefaultExportTileCacheParameters method
Creates and returns a Future of ExportTileCacheParameters
.
This function is asynchronous because it makes use of the service metadata
to build an ExportTileCacheParameters
object. Calling the function will
trigger load of the ExportTileCacheTask, unless it's already loaded.
The supported geometry types for the area of interest are Envelope and Polygon. The area of interest must have a spatial reference. When a Polygon is supplied, tiles will be filtered according to the polygon geometry, which can help reduce the size of the resulting tile package. Note that the filtered set of tiles may vary, depending on the underlying service.
The value of min_scale must be larger than the value of max_scale, unless they are 0. A min_scale value of 0 will result in this method choosing the services smallest level number, typically level 0.
Similarly, a max_scale of 0 will result in the services largest level number being used, representing the closest in view being visible when taken offline. If min_scale is between the scales of tile levels the previous smallest level is used.
If max_scale is between tile levels the next level is taken to ensure it is displayed. For example a simple service has 4 levels: level 0 scale 2000000; level 1 scale 1000000; level 2 scale 500000; level 3 scale 250000.
A min_scale of 0 and max_scale of 0 selects all levels 0,1,2,3.
A min_scale of 750000 (between levels 1 and 2) and a max_scale of 25000 (at level 3) will select levels 1,2,3.
A min_scale of 0 and a max_scale 750000 (between 1 and 2) will select levels 0,1,2.
A min_scale of 1000000 and a max_scale of 0 will select all levels from 1 onwards 1,2,3.
Be careful when combining a large extent or a wide range of scales, this can result in the export failing due to exceeding the services maximum export tile count.
Parameters:
areaOfInterest
— A Geometry specifying the area to be exported. Must be non-null.minScale
— The map scale '1:min_scale' which determines how far out to take offline. Can be 0 for the furthest out.maxScale
— The map scale '1:max_scale' which determines how far in to take offline. Can be 0 for the closest in the service allows.
Return Value: A Future containing an ExportTileCacheParameters
.
Implementation
Future<ExportTileCacheParameters> createDefaultExportTileCacheParameters(
{required Geometry areaOfInterest,
required double minScale,
required double maxScale}) {
final taskHandle = _withThrowingErrorHandler((errorHandler) {
return runtimecore
.RT_ExportTileCacheTask_createDefaultExportTileCacheParametersAsync(
_handle,
areaOfInterest._handle,
minScale,
maxScale,
errorHandler);
});
return taskHandle
.toFuture((element) => element.getValueAsExportTileCacheParameters()!);
}