---
title: "Download map tiles along a specific route - Kotlin SDK | Mobile sdk | Mobile sdk android | Android"
description: "Offline API allows you to download map tiles along a specific route."
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Download map tiles along a specific route - Kotlin SDK

The MapTiler SDK for Kotlin provides a powerful Offline Pack API that allows you to download map tiles along a specific route defined by a GeoJSON LineString for use without an active internet connection.

Before you begin, ensure you have followed the [Android getting started with offline pack API](https://docs.maptiler.com/mobile-sdk/android/examples/offline-get-started/) to set up your project and obtain your API key.

## Offline Pack for a Route (GeoJSON LineString)

```kotlin
import com.maptiler.maptilersdk.offline.MTOfflineManager
import com.maptiler.maptilersdk.offline.MTOfflineRegionDefinition
import com.maptiler.maptilersdk.offline.MTOfflineRegionGeometry
import com.maptiler.maptilersdk.map.style.MTMapReferenceStyle
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch

// Your GeoJSON LineString
val routeGeoJson = """
{
    "type": "LineString",
    "coordinates": [
        [8.5417, 47.3769],
        [8.5427, 47.3779],
        [8.5437, 47.3789]
    ]
}
"""

MainScope().launch {
    try {
        // Parse the route geometry from GeoJSON
        val geometry = MTOfflineRegionGeometry.Route.fromGeoJson(routeGeoJson)

        // Create the route definition with 1000m padding
        val routeDefinition = MTOfflineRegionDefinition(
            geometry = geometry,
            minZoom = 0,
            maxZoom = 14,
            referenceStyle = MTMapReferenceStyle.STREETS,
            padding = 1000.0
        )

        // Create and download the pack
        val pack = MTOfflineManager.createPack(context, routeDefinition)
        pack.download()
        println("Route download started")
    } catch (e: Exception) {
        e.printStackTrace()
    }
}
```

## Learn more

For more information browse our [API Reference](https://docs.maptiler.com/mobile-sdk/android/api/)

Check out our [SDK Kotlin Examples](https://docs.maptiler.com/mobile-sdk/android/examples/).
