# Recommend Offline Region

This guide covers how to help users choose the right offline regions by recommending regions near the current position or along a route, then display region boundaries on the map before download.

## Recommend Regions by Current Position or Route

```kotlin
val radiusTask = NBNavigation.getCountiesInRadius(
    latitude,
    longitude,
    50_000.0,
    regionListCallback
)

val routeTask = NBNavigation.getCountiesAlongRoute(
    directionsRoute,
    regionListCallback
)
```

These two APIs return recommended regions only and they do not start downloads. Call `cancel()` on the task when its result is no longer needed or when the screen is destroyed. The radius **must be** a finite, non-negative value in meters, and the route must contain at least two valid geometry points.

> _The region selection produces the_ `regionId` _used by the download APIs in the next section of this guide._

## Display Region Boundaries

```kotlin
NBNavigation.getRegionBoundary(
    regionId,
    object : NBNavigationTaskCallback<OfflineRegionBoundary> {
        override fun onSuccess(result: OfflineRegionBoundary?) {
            result?.geoJson?.takeIf { it.isNotBlank() }?.let {
                updateSelectedRegionGeoJsonSource(it)
                zoomToRegionBoundary(it)
            }
        }

        override fun onError(throwable: Throwable) {
            showOfflineError("Loading region boundary failed", throwable)
        }
    }
)
```

When boundary details are missing locally, the default overload may access the network. For a local-only batch read, use _getRegionBoundary(longArrayOf(...), false, callback)_. Retrieve all installed road-network boundaries with _getInstalledRoutesRegionBoundaryFeatureCollection()_ and pass the result directly to a map GeoJSON Source.

The Maps SDK manages installed map databases automatically through the normal `MapView` lifecycle and the application does not need to register database paths manually.

To move the map camera to an installed region, call _focusMapTilePreviewRegion(nextbillionMap, regionId)_ on the main thread and check its return value.
