Loading the Region Catalog
After initialization, synchronize the routing catalog and read the combined region list. The combined list contains routing catalog entries, map catalog entries, and installed map packages by regionId.
Sync and read the region list
Note that syncOfflineRegionList(syncMode: .auto) uses the cache freshness policy. For an explicit user refresh use .force. Also, fetchRegionLists does not synchronize catalogs and it does not fail the entire request when one component fails. Instead, it reports component errors through routeError, mapError, and mapInstalledError, so the screen can display content that loaded successfully.
Catalog API comparison
| Method | Network access | Result | Recommended use |
|---|---|---|---|
| syncOfflineRegionList | May access the network | Synchronizes the routing catalog according to the selected sync mode, then returns the locally cached catalog filtered by countries. | Initial load or refresh |
| listOfflineRegions | Does not synchronize automatically | Reads the locally cached routing catalog without synchronizing it. | Offline access and local state |
| fetchRegionLists | Reads the current component catalogs | Combines routing data, maps, and installed packages while preserving component-level errors | Unified management screen |
Region List Item Fields
| Field | Meaning | Recommended use |
|---|---|---|
regionId | Region identifier used by the current routing and map catalogs and as the join key for region-management APIs. | Use it for list diffing, caching, and every download, pause, resume, cancel, delete, and progress API. Do not use displayName as a key. |
displayName | Merged display name. The SDK prefers the routing name, then the map-catalog name, the installed-map name, and finally regionId. | Use for display only. The name may change with catalog content or localization. |
country / adminL1 / adminL2 / adminL3 | Merged administrative hierarchy. Values are optional, and the map catalog does not provide adminL2. | Use for grouping, filtering, and breadcrumbs. Handle nil and do not assume that every level exists. |
routeRegion | OfflineRegionLeaf from the current routing catalog. | Read routing version, estimated size, download state, update state, and bounds. nil means that this merged result has no available routing-catalog entry. |
mapRegion | OfflineMapCatalogEntry from the current map catalog. | Read map version, estimated size, tile count, and map update state. nil means that this merged result has no available map-catalog entry. |
mapInstalledRegion | OfflineMapInstalledRegionEntry for map packages installed on the device. | Determine whether a map is installed and whether all packages are valid. nil usually means that no local map package exists for the region. |
routeSizeBytes | Estimated total size declared by the routing catalog, in bytes. Present only when routeRegion exists. | Use for pre-download display or capacity estimates. It is not the live downloaded or remaining byte count. |
mapSizeBytes | The map-catalog estimated size, or the installed map-package total when no map-catalog entry is available, in bytes. | Use for size display. Because the source may be a catalog estimate or local package total, do not treat it as remaining download bytes. |
fetchRegionLists returns regionRows merged by regionId from the routing catalog, the map catalog, and locally installed map packages. Optional values in a row may be “nil”, so evaluate each dataset independently. A missing component object does not by itself mean that downloaded data was lost.
Useful Nested Fields
The following fields cover the common status, version, and diagnostic needs of an offline-region management screen.
| Field | Meaning | Guidance |
|---|---|---|
routeRegion.downloadStatus | Routing download state: idle, downloading, complete, partial, failed, paused, or unknown. | Use for routing-specific status text. For combined controls, prefer overallState from observeOfflineRegionProgress. |
routeRegion.tilesDone / tilesTotal | Number of routing tiles written and total routing tiles. | Use for local-state diagnostics. Use the progress observation APIs for live download progress. |
routeRegion.isDownloaded / isPartial | Completion and partial-download flags calculated by the SDK from the status and tile counts. | Prefer these properties instead of duplicating completion rules in the application. |
routeRegion.version | Routing-data version in the current catalog. | Use for diagnostics or display. Use updateAvailable for the update decision instead of comparing strings alone. |
routeRegion.timestampSec / dataVersionLabel | Catalog version timestamp and the SDK-formatted yyyy-MM-dd value. | Use timestampSec for custom formatting and dataVersionLabel for a simple display value. |
routeRegion.totalSizeBytes / sizeWithUnit | Estimated routing size in bytes and the SDK-formatted size string. | Use totalSizeBytes for consistent app-wide formatting or sizeWithUnit for quick display. |
routeRegion.detailSyncStatus | Routing-detail synchronization status. Current common values are ok, missing, and stale. | Use for detailed diagnostics. Do not treat it as a download state. |
routeRegion.updateAvailable | “true” when downloaded routing data has a newer catalog version. The SDK compares the current catalog with the stored detail version and timestamp. | Show an update action after catalog refresh. Uninstalled, incomplete, or catalog-removed regions are not marked as updates solely for those conditions. |
routeRegion.catalogRemoved | A local record or data exists, but the region is no longer present in the current routing catalog. | Do not offer a new download. You may let the user keep or delete the local data. |
routeRegion.boundaryBbox | Optional minimum longitude and latitude bounding box for the region. | Use for viewport intersection or coarse preview positioning. It is not the precise administrative polygon. |
mapRegion.version | Optional version in the current map catalog. | Use for diagnostics or display. Use mapRegion.updateAvailable for the update decision. |
mapRegion.totalSizeBytes / tileCount | Estimated total map size in bytes and number of map tiles in the catalog. | Use for pre-download capacity information and catalog diagnostics. |
mapRegion.updateAvailable | “true” when a map is already installed and either the catalog version differs or the local packages are incomplete. | Show an update or repair action after refresh. This is false for an uninstalled map; use mapInstalledRegion == nil to detect that case. |
mapInstalledRegion.regionVersion | Optional version of the locally installed map packages. | Compare with mapRegion.version for diagnostics; keep business update state based on mapRegion.updateAvailable. |
mapInstalledRegion.packageCount / totalBytes | Number of local map packages and their total byte count. | Use for the installed-content summary and local storage display. |
mapInstalledRegion.allPackagesOk | true when every map package for the region passes the integrity check. | Treat this as a key map-readiness condition. When false, offer retry or update. |
mapInstalledRegion.dataSourceId / dataSourceLabel | Identifier and readable label for the installed map data source. | Use for diagnostics or an advanced information screen. Do not use it in place of regionId. |
Checking Size Download State and Updates
Refresh the catalogs through the normal screen flow before reading regionRows. The following example evaluates installed and update states separately and shows a combined size only when at least one size is known:
- Size fields: routeSizeBytes and mapSizeBytes are suitable for pre-download estimates. During a download, read downloaded, total, and percent from observeOfflineRegionProgress or observeUnifiedOfflineProgress.
- Update fields: fetchRegionLists reads the current catalog snapshot and does not synchronize it. To check for the latest update, refresh the catalogs first, then read routeRegion.updateAvailable and mapRegion.updateAvailable.
- Partial failure: regionRows may still contain data from another component when
routeError,mapError, ormapInstalledErroris set. Display the available content and offer retry for the failed component.
Result Level Fields
| Field | Meaning |
|---|---|
routeRegionList | Raw routing catalog for screens that need routing sections or leaves. |
mapRegionList | Raw map catalog and total count for map-catalog diagnostics or a map-only list. |
mapInstalledRegionList | Raw list of map regions installed on the device. |
routeError / mapError / mapInstalledError | Per-component errors. A value in one field does not make all regionRows unusable. |
updatedAt | Time when the SDK created this merged result, not the catalog version time or data publication time. |
Country filter
Country names must use the complete English names from the catalog, such as “India” or the “United States”. By default, fetchRegionLists returns only the “United States”. Pass nil or an empty array to return every country.
Offline Download Screen Lifecycle
Pair the screen ownership calls:
endDownloadPage releases screen ownership but does not cancel region downloads that have already started.