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

    sdkEngine

    Instance 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 of onProgress(...) on the main thread. If there is not enough space left in the cache to store needed tiles, operation will fail with MapLoaderError.notEnoughSpace. To increase cache size, use SDKOptions.cacheSizeInBytes API.

    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:

    1. Create a GeoCircle using the given location and radius.
    2. Create a GeoPolygon using the GeoCircle.
    3. 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) -> TaskHandle

    Parameters

    geoPolygon

    Area to prefetch map data for.

    callback

    Callback 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) -> TaskHandle

    Parameters

    geoPolygon

    Area to estimate map data size for.

    callback

    Callback 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.