Skip to content

offline

const offline: object

Defined in: src/offline.ts:21

Take maps and data offline, mirroring ArcGIS.OfflineMapTask and the related export/sync tasks. Each call is an asynchronous job that downloads files to the app’s storage; pass the returned path to <Map mobileMapPackagePath> to display a downloaded offline map. Services must be offline-enabled (sync / exportTiles capability).

downloadPreplannedOfflineMap: (portalItemId, areaIndex, downloadName) => Promise<JobRef<OfflineMapResult>>

Downloads a preplanned offline map area (by areaIndex) into a directory named downloadName. Returns a JobRefawait job.result(), observe onProgress, or job.cancel().

string

number

string

Promise<JobRef<OfflineMapResult>>

estimateTileCacheSize: (tileServiceUrl, areaOfInterest, options?) => Promise<TileCacheSizeEstimate>

Estimates the on-disk file size and tile count for an exportTileCache download WITHOUT downloading. Useful for showing the user a preview before committing to a potentially large download. Returns { fileSize: number, tileCount: number } (fileSize in bytes).

string

Geometry

Record<string, unknown>

Promise<TileCacheSizeEstimate>

exportTileCache: (tileServiceUrl, areaOfInterest, downloadName) => Promise<JobRef<OfflineTileResult>>

Exports a raster tile cache (.tpkx) from a tile service for areaOfInterest.

string

Geometry

string

Promise<JobRef<OfflineTileResult>>

exportVectorTiles: (vectorTileServiceUrl, areaOfInterest, downloadName) => Promise<JobRef<OfflineTileResult>>

Exports a vector tile package (.vtpk) from a vector tile service for areaOfInterest.

string

Geometry

string

Promise<JobRef<OfflineTileResult>>

generateGeodatabase: (featureServiceUrl, extent, downloadName) => Promise<JobRef<OfflineGeodatabaseResult>>

Generates a .geodatabase from a sync-enabled feature service for extent, downloading it as downloadName. The returned path can be synced back later with syncGeodatabase.

string

Geometry

string

Promise<JobRef<OfflineGeodatabaseResult>>

generateOfflineMap: (portalItemId, areaOfInterest, downloadName, overrides?) => Promise<JobRef<OfflineMapResult>>

Takes a web map (portalItemId) offline on-demand for areaOfInterest (an envelope/polygon), downloading a mobile map package into a directory named downloadName. Returns a JobRef: await job.result() to run it, job.addListener('onProgress', …) for progress, job.cancel().

Pass optional overrides to narrow the tile-cache scale range and reduce download size:

offline.generateOfflineMap(id, area, 'myMap', { minScale: 0, maxScale: 5000 })

See OfflineMapParameterOverrides for details on how minScale/maxScale are applied.

string

Geometry

string

OfflineMapParameterOverrides

Promise<JobRef<OfflineMapResult>>

openGeodatabase: (path) => Promise<GeodatabaseHandle>

Opens a local mobile geodatabase (.geodatabase file, e.g. from generateGeodatabase) for transactional editing — wrap edits in beginTransaction then commitTransaction or rollbackTransaction.

string

Promise<GeodatabaseHandle>

preplannedMapAreas: (portalItemId) => Promise<PreplannedMapAreaInfo[]>

Lists the preplanned offline map areas published with the web map portalItemId.

string

Promise<PreplannedMapAreaInfo[]>

syncGeodatabase: (geodatabasePath, featureServiceUrl) => Promise<JobRef<{ synced: boolean; }>>

Bidirectionally syncs a downloaded geodatabase with its feature service.

string

string

Promise<JobRef<{ synced: boolean; }>>

syncOfflineMap: (mobileMapPackagePath) => Promise<JobRef<{ synced: boolean; }>>

Syncs a downloaded offline map (.mmpk at mobileMapPackagePath) with its services — pushes local edits up and pulls server updates down. Returns a JobRef (await job.result()).

string

Promise<JobRef<{ synced: boolean; }>>