PolygonPrefetcher
public class PolygonPrefetcher
extension PolygonPrefetcher: NativeBase
extension PolygonPrefetcher: Hashable
Supports downloading of map data - in advance - into the cache to optimize temporary offline use cases that rely on cached map data. Please note, this class puts data in the map cache, which has its own size constraints, and extensive usage may start evicting old cached data. Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
Creates a PolygonPrefetcher instance for a given
SDKNativeEngine.Declaration
Swift
public init(_ sdkEngine: SDKNativeEngine)Parameters
sdkEngineInstance of an existing SDKEngine.
-
Prefetches map data for an area bounded by geo polygon. After the operation is finished
onComplete(...)is invoked on the main thread. Progress is reported by invocation ofonProgress(...)on the main thread. If there is not enough space left in the cache to store needed tiles, operation will fail withMapLoaderError.notEnoughSpace. To increase cache size, useSDKOptions.cacheSizeInBytesAPI.To control list of map content features for area prefetch, use
LayerConfiguration.enabledFeatures.To prefetch map data within user-defined circular area around a given location:
- Create a GeoCircle using the given location and radius.
- Create a GeoPolygon using the GeoCircle.
- Pass the afroementioned GeoPolygon to the sdk.prefetcher.PolygonPrefetcher.prefetch API. Usage: GeoCircle geoCircle = GeoCircle(location, radius); GeoPolygon geoPolygon = GeoPolygon.withGeoCircle(geoCircle);
Declaration
Swift
public func prefetch(geoPolygon: GeoPolygon, callback: PrefetchStatusListener) -> TaskHandleParameters
geoPolygonArea to prefetch map data for.
callbackCallback that is triggered to report progress and the result of prefetch.
Return Value
Handle that will be used to manipulate execution of the task.
-
Estimates map data size for the area bounded by geo polygon. Size for tiles that are already in the cache will not be included in the final result.
Declaration
Swift
public func estimateMapDataSize(geoPolygon: GeoPolygon, callback: MapDataSizeListener) -> TaskHandleParameters
geoPolygonArea to estimate map data size for.
callbackCallback that is triggered to report the result of map data size estimation.
Return Value
Handle that will be used to manipulate execution of the task.