N-Ways
Developer docsOffline packs

Offline packs

Maps that keep working where the network drops: download a city or a delivery zone ahead, on Wi-Fi.

On this page

Riders lose the network under bridges, in markets and on the way out of town. An offline pack is a region’s map and routing data, downloaded ahead (on Wi-Fi, at the depot), so your rider app keeps showing the map and planning routes without a connection.

Note:

Offline packs come with fleet tracking (plan by agreement). Reference

What’s in a pack

FileWhat it isOpen it with
map.pmtilesThe region’s vector map to zoom 15, the same tiles the Maps SDKs drawMapLibre Native (pmtiles:// on a local file), or the Android and iOS SDKs
routing.tarThe region’s road graph for on-device routingAn on-device routing engine that reads Valhalla tiles

A pack is rebuilt when the map or the road graph changes: its version changes, and each file has its size and SHA-256, so your app downloads only what changed.

Download a pack

  1. GET /maps/v1/fleet/offline/regions lists the ready-made regions (Lagos, Abuja, Ibadan, Port Harcourt, Kano, Accra, Kumasi, Cotonou, Lomé, Libreville, Abidjan, Monrovia, Conakry, Freetown, Bissau, Dakar, Douala, Yaoundé, Ouagadougou, Bobo-Dioulasso, Praia, Mindelo and more) with their boxes. For your own delivery zone, ask for the region custom-<minLng>_<minLat>_<maxLng>_<maxLat>: up to 0.6° across, on a 0.05° grid.
  2. GET /maps/v1/fleet/offline/packs/{region} gives the manifest. A 202 means it’s being built: ask again after Retry-After seconds.
  3. Download each file from its url with your key. Downloads can be resumed with HTTP Range, and the ETag is the file’s hash.
cURL
curl "https://nways.ng/maps/v1/fleet/offline/packs/lagos" -H "X-NWays-Api-Key: YOUR_APP_KEY"

Show it on the map

Point the style’s vector source at the downloaded file. With the N-Ways SDKs, download the hosted style once too and replace its tile address with the local file:

Android
// The pack's map, saved in the app's files.
val local = "pmtiles://file://" + File(filesDir, "packs/lagos/map.pmtiles").absolutePath
val style = savedStyleJson.replace(Regex("pmtiles://https://[^\"]+"), local)
map.setStyle(Style.Builder().fromJson(style))

Keep in mind

  • Packs are for your own apps’ users, not for redistribution. The OpenStreetMap credit still shows on the map.
  • Search and fares need the network; plan around it (cache the day’s addresses before leaving).
  • Refresh packs weekly: roads, bans and one-ways change.