Skip to content
miracle091 edited this page Dec 2, 2026 · 10 revisions

Map

English · Italiano

This page explains the choices behind the offline map, the overview map, the world map, the Navigator and turn-by-turn navigation.

Offline map in PMTiles

The map is a PMTiles file: a single file that holds all the vector tiles (the squares of the map, with streets and buildings as shapes and not as images). MapLibre, the library that draws the map, reads it directly (pmtiles://). This avoids the need for a tile server or thousands of small files.

Offline map of San Marino with points of interest and the filters button with the number of hidden categories

Extraction on the device

The device does not download a map prepared by the project. From the daily Protomaps build it reads only the tiles inside the region's bounding box, with HTTP byte-range requests, and writes them to a file of its own.

Identical tiles, such as the sea, are stored only once. They are recognized by their content, without computing a SHA-256 hash.

Memory stays low even for very large regions (Siberia, Nunavut, the Russian Far East):

  • the extraction proceeds in blocks of tile ids;
  • the index of the tiles already written sits in a temporary file, not in memory;
  • the index entries arrive in id order; when they do not, they are sorted in chunks on disk;
  • the directory of the final file (root and leaves) is written as a stream;
  • to recognize identical tiles the app remembers only contents up to 4 KB, in a table of at most 2 MB that keeps those already repeated.

A tile content that the table has forgotten is written again. The file stays correct, only a little larger. With 3.5 million tiles, the memory used is about 2 MB instead of 240 MB.

Reading over the network

The build is read with the app's OkHttpClient. Every response goes through these checks:

  • it must be a 206 with a Content-Range consistent with the request; a 200 response is rejected;
  • the ETag of the build must stay the same for the whole extraction.

The connection and read timeouts are 15 and 30 seconds. Network errors, 5xx, 408 and 429 are retried up to 3 times, after 1 and 3 seconds. With "Cancel" the request in progress stops immediately.

Neighboring tiles are requested together, in blocks that last about 6 seconds at the average speed of the previous reads (moving average). A block ranges from 256 KB to 16 MB; the first is 1 MB.

A read that receives data a trickle at a time does not trigger the timeout. For this reason the app checks it by itself: it interrupts the read and retries on a new connection, like a network error, in two cases:

  • for 15 seconds, counted from the arrival of the headers, the speed stays below 2 KB/s;
  • after at least 3 reads, the speed stays below a tenth of the average.

Without this check, on the emulator reading the Siberia map dropped to 20 KB/s on a 16 MB block, which the PC received in a little over a second.

After a stall, the chunks are sized to the speed just observed. The threshold, instead, stays at a tenth of the previous average, which drops only with completed reads. If even the new connection is that slow, when the attempts run out the region shows the error. The alternative would be to continue for minutes at a few KB/s.

A large read is done in chunks of the same duration. If the network slows down halfway, the following chunks get shorter. A new attempt restarts from the byte already received, not from the beginning.

The connections of the build live in a pool separate from the app's. The pool is emptied after every stalled read and at the end of the extraction, because Call.cancel() alone does not close an HTTP/2 connection. "Cancel" also interrupts the final writing of the file, and a half-written file is deleted.

Reading in blocks

The Protomaps build keeps neighboring tiles one after the other. For this reason the device reads them in blocks of 16 MB, skipping gaps of up to 256 KB, instead of making one request per tile. The map of Latvia (248 MB) takes about 3 minutes on the emulator instead of over an hour, with 5% more data.

During the extraction, the region row shows "Extracting the map · X%". The percentage is computed on the bytes of the tiles to download, read from the index of the build.

The size of the map is not known before the extraction. In the country list, the size of a download or an update that includes the map is shown as "6.3 MB + map", and on mobile data the app asks for confirmation. The same applies to the map alone from the region's Content: "The map can exceed 100 MB and the download uses mobile data. Continue?".

Differential updates

When a new version of the map of an already downloaded region comes out, the device compares the index of the new build with that of its own file. It downloads only the new or changed tiles and copies the others from the file it already has. A tile is considered identical if it has the same length.

For Italy, after a month, the update is about a third of the data instead of 2.3 GB. If the comparison fails, the device downloads the whole map.

At low zoom levels a tile covers a large area and often changes content without changing length: in San Marino, 3 tiles out of 75 between two builds six days apart. For this reason the tiles up to z6 are always downloaded again. For Italy they are about 1.7 MB; up to z10 they would be 115 MB.

Test on Latvia with two builds six days apart (Sep 26 → Oct 2, 2026):

Measure Value
Tiles downloaded 1,125
Tiles copied 84,290
Network data 62 MB instead of 263 (24%)
Requests 281 instead of 153

The requests double because the changed tiles are scattered: data is saved, not necessarily time.

The resulting file is not identical to a map downloaded from scratch. In the test, 58 tiles out of 85,415 (0.07%, between z9 and z14) had changed without changing length. The old ones stay until a later update really changes them. This is the price of comparing by length: the PMTiles index has no hash per tile. Raising the threshold of the always-downloaded tiles to z8 would not have caught any of them.

A different path for each version of the file

MapLibre keeps the header of a PMTiles file in memory for the whole life of the app. If the file is replaced at the same path, MapLibre reads wrong data and the app crashes. For this reason each version of the file has a different path (.v-<name>-<date>/../file.pmtiles). Links to the file are not an alternative: Android does not allow apps to use them.

Light map

In the Content of each country, the Light map switch removes zoom 14, the highest zoom level of the map: the extraction does not look for it in the index. The choice applies to the whole region.

The switch is on by default, so a map downloaded from scratch is light. A detailed map that is already installed stays detailed through updates, until the switch is changed.

The light file declares 13 as the maximum zoom and the style reads it from the header. When zooming in, MapLibre enlarges z13 instead of leaving gaps.

Changing the choice extracts the map again with the differential update. Switching to the light map downloads nothing, because the tiles are copied from the installed one. Switching to the detailed map downloads only z14. Measurements on the emulator:

  • Île-de-France: from 120 to 56 MB in a few seconds and offline, and back to 120 MB in about 30 seconds;
  • San Marino: from 2.5 to 2.0 MB, with the same memory used at z17.

Without z14, small buildings (scattered houses, part of the buildings in cities) and the names of many minor streets are lost. Roads, paths, localities and points of interest remain.

Why all or nothing

Zoom 14 is almost half of the map: Latvia 111 MB out of 254, Italy 1.1 GB out of 2.3. The alternative considered was to download it only under "dense" z13 tiles and let MapLibre enlarge z13 elsewhere. The indexes of the Oct 2, 2026 build give these measurements, keeping z14 only under a z13 tile of at least N KB:

Threshold Latvia: savings Italy: savings z13 tiles that keep z14 (LV / IT)
10 KB 82 MB (~32% of the map) 254 MB (~11%) 5.9% / 22%
20 KB 100 MB (~39%) 569 MB (~25%) 1.1% / 9.3%
40 KB 107 MB (~42%) 909 MB (~40%) 0.2% / 2.2%

In Latvia the heavy z14 is all in a few cities: at 20 KB, Riga, Jurmala and Cesis remain. Not in Italy: mountains and villages sit between 10 and 30 KB (Cortina 27, Abetone and Cinque Terre 18, Gran Sasso 16). The large saving would come only from removing z14 exactly where people walk.

Without z14 the Protomaps map also loses:

  • sidewalks and crosswalks;
  • trams, funiculars and narrow-gauge railways;
  • the more precise outlines of buildings;
  • some points (parks, cemeteries, supermarkets).

Paths, minor roads and peaks are already there at z13.

A z14 that covers only part of the map does not work with MapLibre: within the maximum zoom, a missing tile stays empty and is not derived from the one below. For this reason the choice is all or nothing per region (Oct 2, 2026).

Map style

The MapLibre style is the file that says how to draw each layer of the map: colors, widths, labels, filters. It lives inside the app, so a fix to it also applies to maps already downloaded, without downloading them again.

Water

The Protomaps water layer contains both the water areas and the lines of watercourses. The areas have the Polygon filter. Without this filter the style would also fill the lines as polygons: wedges of water in the Djibouti desert, a very wide Rhine in Liechtenstein. Rivers, streams and canals are thin blue lines in a separate waterways layer, also in the world map.

Place and street names

The names follow the language of the app:

  • in Italian: name:it, then name:en, then the local name;
  • in English: name:en, then the local name.

In the cards of points of interest, in the Guide and in the assistant, Italian skips name:en in Italy, San Marino, Vatican City and Italian-speaking Switzerland, because there the local name is already Italian. Italian-speaking Switzerland is an approximate polygon of Ticino with Mesolcina and Calanca, Bregaglia and Valposchiavo (isItalianSpeakingPlace).

In the world map, the English names of the countries come from the country code.

Fonts

The map font is Noto Sans, inside the app. It covers extended Latin (Latvian, Polish, Turkish, Vietnamese…), Greek, Cyrillic, Armenian, Hebrew, Arabic, Thai and Georgian.

Chinese, Japanese and Korean are missing, as they would require hundreds of files. The Indic scripts, which MapLibre cannot shape, are missing too. In these scripts a name without name:it or name:en does not show on the map; it shows in the card of the point.

Filters and markers

Map filters divided into groups, each with its own switches ### Filters

The filters are in the button at the bottom right, in a sheet divided into groups (Hotels and restaurants, Sights and leisure, Health and emergencies…). A number on the button counts the hidden categories. The sheet replaces a row of chips above the map: with more than 20 categories the row would cover the map and show three or four at a time.

The sheet lists only the categories present in the region. A crossed-out eye hides all the categories: at the top for the whole sheet, next to each group for the group. An eye shows them all. At the top only the useful icon appears, or both when some categories are hidden and others are not. The text "Show all" or "Hide all" stays as the description for TalkBack.

Markers

The app shows at most about 3,000 points of interest of the framed area. It chooses them by cell, so the sample covers the whole area. Loading all the points together would crash the app with an out-of-memory error in the Map tab of Italy downloaded in full.

Hidden categories, "In a wheelchair" and "Accessible places only" are applied in the query, before counting and choosing the sample. With "pharmacies only" the sample is chosen among the pharmacies, not among all the points to then remove the hidden ones. For the same reason, disabled parking spaces do not occupy cells.

The categories present in the area come from the same query, filters included. A hidden category therefore stays in the sheet, so it can be turned on again.

Two indexes on the points of interest keep these queries fast in large countries: region and latitude, and region and category code with the OSM tag. From the second, the categories present are read without scanning the table. The categories are read once per region, not at every movement.

To know whether the area exceeds the maximum, the query asks for one row more than the maximum instead of counting the whole area.

On an area taller than half a degree, the sample is chosen by reading the region in rowid order (spreadInWideBounds). At that height, the latitude band of a large country already has tens of thousands of rows scattered on disk, which are more expensive to read than the table in sequence.

The requests to reload the markers go through a single conflated collector. A load that has started always finishes, and then the most recent state is read. Canceling it every time the map stops moving would leave a large country without markers.

A view straddling 180° (New Zealand, the Russian Far East, Alaska) shows the markers like the others.

The markers are a layer of the style: a GeoJSON source with a symbol layer. The app does not use the MapLibre annotation plugin, which no longer receives updates. With that plugin, the symbol manager had to be closed before every style change, otherwise the app crashed.

Types and categories of points of interest

Under the name, the point's panel and the search results show the precise type (poiTypeLabel in PoiTypes.kt). When the tag has no type, they show the category. Famous places taken only with wikidata have their own type: Bridge, Square (also pedestrian squares and street relations), National park, Peak, Mountain range. Monumental sites (type=site) show "Historic site".

Some types have a category of their own:

  • Marinas, in the Transport group, with the sailboat icon.
  • Currency exchange (amenity=bureau_de_change), in the group with banks and ATMs, with the currency_exchange icon, visible in every mode. Grouped with banks, exchange offices would get lost. In 28 countries of Asia, Africa and South America they are 4% of the banks (3,221 against 83,229), but in tourist countries many more: Emirates 59%, Tanzania 33%, Thailand 13%.
  • Internet cafes (amenity=internet_cafe), in the Public services group next to libraries, with the computer icon. By default they show only when walking and with public transport. They are useful to print a boarding pass, make a call or use a PC. In 42 regions there are 7,750, mostly in India, the Philippines, Ethiopia, Japan (many are manga kissa open at night) and South America; in North America almost none.

Open-air markets (amenity=marketplace) are among the shops. Holiday villages and residences (leisure=resort) are among the accommodations.

There is no "Other" filter: a point without a precise category does not appear on the map (see Points of interest in Data and packages). The versions of the app that still have "Other" show the types moved to the new categories there.

Icons and excluded networks in the Guide

The icons of the Guide sections and the card of the excluded networks are described in Guide sections and Timetables not included.

What appears when the map is missing

The Map tab is never empty. It shows the first available of these maps:

  1. the full map, if it is downloaded;
  2. the overview map of the region: main roads and borders, zoom 0–9, at most 10 MB; it arrives with every download of the region;
  3. with a connection, the world map (zoom 0–8): a project file published on GitHub and read in chunks;
  4. a background saying that the map is missing, with the button to download it.

Points of interest always show. A bar reminds the user that street detail and route calculation require the downloaded map and road network. If its "Download" does not reach the catalog, the bar says so in place of the reminder. When Android blocks the app's network access, it also says the reason.

The map source stays undefined (null in MapRouteViewModel) until the file check finishes. Without this wait, the "Download the map" bar would appear for a moment even with the map already installed.

When returning to the Map tab from the Guide or the Navigator, the map stays where it was left. The tabs of the region page are in a SaveableStateHolder, which keeps the camera. The framed area resets only when the region changes.

Country map

The country map colors the countries according to their status: available and downloaded. The status arrives after the first style, when the catalog is loaded.

The style reloads only for theme and language. The available and downloaded countries are two fixed-color layers above the land. Their filter on the country codes is changed with setFilter, which recomputes the layers.

The reason is a behavior of MapLibre 13.7.1: a new style with the same GeoJSON reuses the tiles already prepared and does not recompute the added or changed layers. A second setStyle with the color by state would leave the countries black or without color.

For the same reason each language has its own label source (labels-it, labels-en), which MapLibre draws from scratch. With a single source, after a language change the country names would stay in the previous language.

In a wheelchair

The "In a wheelchair" checkbox hides the places that are not accessible and shows badges and disabled parking spaces: the choices are in Accessibility and voice.

Stops and departures

The card of a stop shows the departures of the next three hours, with delays where the agency publishes them. The "Nearby stops" button lists the stops within 500 meters: rules and reasons are in Public transport.

Navigator

The Navigator appears in two places:

Navigator without a destination: the current location and nearby points of interest, with the “Search for a destination” search Navigator with the walking route to the Palazzo Pubblico in San Marino: the favorites star, Add waypoint, the travel modes up to public transport, time, distance, Other routes and the start button
  • in the main bar (Countries, Navigator, Documents, More), to search and navigate across all the downloaded countries;
  • as a tab of each region page (Guide, Map, Navigator, AI), with that region first in the search.

Destination and navigation in progress are the same in both places. How the code achieves this is explained in Navigator in Architecture.

The screen follows the model of navigation apps:

  • the map at full screen;
  • without a destination, the "Search for a destination" bar at the top;
  • with a destination, a panel attached to the edge with start, arrival, the button to swap them and the travel mode;
  • at the bottom, a draggable panel with time and distance, Start and the turns of the route.

The initial mode follows the travel modes chosen: the car if there is a car or camper, otherwise the bike, otherwise walking.

Searching for the destination

By name

The search looks by name among the points of interest of all the installed regions, the open one first. The results show type, distance and region.

Case and accents do not matter: "riga" finds "Rīga", including names in Cyrillic or Greek. Each letter becomes the group of its variants in a SQLite GLOB pattern. This way the search requires neither indexes nor database migrations.

The rule holds in both directions also for letters that are not a base letter with an accent (ł, ø, đ, ð, ħ, ŧ, ı): "Łódź" finds "Lodz" and "kırklareli" finds "Kirklareli". Names written in OpenStreetMap with the accent separated from the letter are found only in the points-of-interest packages built with this normalization; those installed earlier receive it when they are updated.

Places to visit (museums, monuments, places of worship, attractions, theme parks and zoos) and names that match the search exactly come first, then distance. This way "Louvre" gives the museum before hotels and parking lots with its name.

By address

The search also reads addresses such as "Via Roma 12" or "12 Rue de Rivoli", in the regions with house numbers downloaded. The house number is the last word if it looks like a house number, otherwise the first. The results have the type "Address".

With the house number, the exact address is found. Without it, one entry per street appears, on the house number closest to the center of the street.

The data are in the region's address search index (see Address search index). The regions with house numbers downloaded before this index give no results until their cells are updated.

Coordinates and links

In the destination and waypoint fields, the following can be typed:

  • coordinates in decimal degrees ("43.6, 1.44", "43,6 1,44"), with a comma, a semicolon or a space between the two numbers, or in degrees, minutes and seconds (41°53'24.8"N 12°29'32.3"E, N 41° 53.413' E 12° 29.538');
  • full Plus Codes ("8FHJVHXV+5Q", also in plus.codes and Google Maps links);
  • Google Maps links (@lat,lon, !3d…!4d…, q, query, ll, destination, daddr, the name from /place/; in old links destination and daddr count more than ll, which is the center of the map); of a route (/maps/dir/…) only the arrival is taken;
  • OpenStreetMap links (mlat/mlon, #map=zoom/lat/lon) and their short links (osm.org/go/…), which already contain the coordinates;
  • Apple Maps links (ll, q, coordinate, sll, and for a route the arrival from daddr), Waze (ll, q and waze.com/ul/h… links), Organic Maps and CoMaps (omaps.app/…, ge0://…), OsmAnd, HERE WeGo, Mapy and Magic Earth.

These texts immediately give the single "Coordinates" row, without the search by name (readPlace in PlaceReader.kt). The exception is links with a text to search, such as those of Google Maps without coordinates (q, query, the name from /place/ or /search/), Waze (q), HERE WeGo (/search/…, /discover/…) and Mapy (q): the destination is that name and the search starts, not the center of the link's view, unless the text is already a pair of coordinates. The point goes to the installed region whose bounding box contains it, otherwise to the open one.

Shortened links of Google (goo.gl, maps.app.goo.gl), Apple (maps.apple/p/…) and Mapy (mapy.com/s/…, mapy.cz/s/…) hold only a code and are read online, after consent (ShortLinkExpander.kt):

  • at the first link a dialog says which service is contacted; "Allow" applies to the three services and can be changed with "Shortened links" in More → Settings, "Not now" lasts while the search stays open;
  • the request starts only with the search on screen, and is canceled if the text changes. It holds only the code of the link and the app's User-Agent, without cookies. There are at most 5 requests, within 10 seconds, only over HTTPS and to the service's domains;
  • the place comes from the redirect address; only Apple's page is read, because it has the point in its meta tags. Google's pages are not opened, because their center can be the position of whoever asks;
  • a pasted link gives the "Coordinates" row, a shared one opens the preview; one typed by hand is read only with the Search key of the keyboard, so no partial code is sent. If it leads only to a name, the search for that name starts. If there is no network, the Search key tries to read it again.

Without consent or a network the app asks to paste the full link. HERE WeGo links (share.here.com/p/…) are read offline when they hold the coordinates; those with only the place id are not read. Short Plus Codes, without the first four digits, are not read either.

From other apps

The Navigator receives a destination from other apps in two ways:

  • a geo: address opened by another app (contacts, browser, chat);
  • a text with coordinates or a map link shared with "Navigator" from the Share menu (alias SharePlaceAlias of MainActivity; "Ask the assistant" remains).

In both cases the Navigator opens with the destination in the route preview, without starting the navigation. A geo:0,0?q=text opens the destination search with that text. A text without a readable place, or a navigation in progress, gives a message. The text is shortened to 2,000 characters.

MainActivity is singleTop. With the app on top of its task, the request reaches the open instance with onNewIntent instead of opening another. Only the visible instance takes it.

Point on the map

A long press on the map in the Map tab shows the destination marker and a "Point on the map" sheet with the coordinates. Navigate here opens the Navigator with that point. Directions in the card of a map point also opens the Navigator with that destination.

Starting point, recent destinations and favorites

The starting point is the user's location (GPS) or another place, searched like the destination. From a chosen place only the route is shown: turn-by-turn navigation starts from the user's own location.

The last 10 destinations stay on the device, the most recent first. The Recent panel starts closed, with the title only, and opens by dragging it. The X removes one destination; the trash can removes them all, with confirmation.

The star next to the destination saves it to favorites under a name of the user's choice, with "Accommodation" suggested under the field. The destination field takes the chosen name, and saving the same point again changes its name. Favorites stay on the device only (FavoriteDestinations, navigation_favorites preferences, at most 50). With an empty field they appear at the top of the recents, in the search for the destination and the waypoints. The filled star or the X removes them.

Without a destination

With GPS on and no destination, the map shows the user's own location and the points of interest around it:

  • within 150 m, or 300 and 600 m if there are fewer than 5 nearby, so in the countryside the map does not stay empty;
  • at most 30, the nearest, with the zoom framing the radius;
  • searched again after every 50 m of movement.

The Navigator search does not restart at every GPS reading, but only when the location moves by more than 200 m.

Before the route is calculated, the map shows the start and arrival regions, not only the open one.

Waypoints

"Add waypoint" adds up to three waypoints between start and arrival. They are searched like the destination: places, addresses, coordinates, recents and favorites. Each waypoint has arrows for the order and the X to remove it. "Swap" puts them in reverse order. A new destination from the card of a map point removes them.

All the points go to BRouter in lonlats: start, waypoints, arrival. For each waypoint the route keeps the index of its nearest point (Route.viaPointIndexes).

The check for a missing road network and the choice of the regions to join also look at the waypoints. With waypoints, there is no retry with a single region when the start or arrival stays isolated, because the route with a single region would skip the waypoints outside that region.

Road network

The road network is the content with roads and paths on which BRouter calculates the routes. It is made of segments in .rd5 files, the BRouter format: 5×5-degree tiles with the network already ready for calculation.

It is not in the normal download of a region, because it is heavy: Italy 840 MB. If it is missing, the screen downloads it with one tap and then calculates by itself. Users who turn on "Navigation routes" (first launch or Settings → Travel modes) receive it with every region.

In Content, the user chooses which travel modes the road network covers (see Data and packages): the full road network or the car-only road network. With the car-only network, on foot, by bike or in a wheelchair the Navigator says so and offers to download the full one. From the Navigator, "Download" for walking or biking always takes the full one.

Missing road network

Before calculating, the Navigator checks whether the line between start and arrival leaves the zones of the downloaded road network. The alternative would be to wait for a generic BRouter error after a long calculation.

If the line leaves, a card lists the regions to download, in order from start to arrival and with the size of each. The download icon downloads them all, with overall progress, and the route is recalculated by itself when they arrive. If the catalog cannot be read (offline), the panel only says that the route leaves the downloaded road network.

The regions follow the overland path between countries. Neighbors are the countries that share a vertex in the Natural Earth borders already in the app. The path is the shortest among the centers of the countries of the catalog. From San Marino to Riga it goes through Italy, Austria, Czechia, Poland and Lithuania, not through Croatia or Kaliningrad, which the straight line grazes over the sea.

For each country, the region under the line is taken or, if the line does not cross the country, its region nearest to the line. A point in the Canary Islands or in Ceuta and Melilla, outside the bounding box of Spain, takes their region, not that of Spain. Without an overland path (islands) the line is followed, skipping the points at sea.

The countries that cross the 180° meridian (Fiji, Chukotka in Russia) have the center in the right place. A border without polygons does not block the calculation.

Route calculation

The route is calculated by BRouter on the device, on the downloaded road network. A BRouter profile (.brf file) is the script that gives each road a cost according to the mode: for example, it forbids stairs in a wheelchair or prefers bike lanes by bike. The route preview always uses the mode and the choice about stairs just changed.

Turns

The profiles have turnInstructionMode = 1, which means "the caller decides". For this reason the request passes timode: without it, BRouter does not calculate the turns. The arrival is added in the app, because BRouter removes it. For roundabouts driven on the left (countries that drive on the left) BRouter gives the exit number as negative.

Snapping to the nearest road

BRouter's DirectWeaver looks for the road nearest to the start and the arrival only among the links in their direction. Without a correction the point sometimes snaps to a road that is not the nearest, and the route stops about 200 m before the destination (BRouter issue #952). The correction is BRouter PR #958, merged after v1.7.10 but not yet in a release. It is in third-party/patches/brouter as patch 0003, applied by the build, to be removed with the update to a release that contains it. By car the route does not change.

Long calculations

Milan–Rome by car (575 km) takes 45–48 seconds on the emulator; a device is slower. The maximum time is 3 minutes, then "destination too far" appears. During the calculation a bar shows an estimate of the progress (see BRouter patches in Architecture).

In the five BRouter profiles pass2coefficient = 1.0. The second pass of the search thus uses the straight-line distance (A*) instead of Dijkstra, the BRouter default (proposed in BRouter issue #967). On Berlin–Dresden and Berlin–Cottbus (120–190 km) the calculation is 1.2 to 2.7 times faster, with an identical route cost or at most +0.002%.

A canceled calculation does not overwrite, with its late progress, the preview of the new route, in the Navigator and in the planner.

Errors

"Retry" is an icon on the message row. A missing calculation profile or an invalid variable in it gives a calculation error with "Retry" and does not close the app. The same applies if the calculation engine cannot be created (profile copy, disk full). Without a location the message is "No GPS signal: turn on GPS or choose a starting point".

The interface says only "route not found" or "road network missing". The BRouter message, with profile, segments folder and explored stretches, goes to the log with the tag RouteEngine, also in release builds. The errors of joining the road networks of several regions go to the same log.

When the road networks of several regions do not join (damaged file, full storage), the Navigator calculates with the first region only. If the route leaves it, it says that the networks could not be joined and asks to free up space and try again.

Journeys by public transport

The "By public transport" mode uses RAPTOR to calculate itineraries with at most three transfers, on a single network: parameters and limits are in Public transport.

Arrival time and departure reminder

Once the arrival time is chosen (today, or tomorrow if that time passed more than an hour ago), the panel shows "Leave at HH:MM" and a card that changes color:

  • neutral;
  • "Leave in X minutes" when little time is left;
  • red, with the minutes of delay, when leaving now no longer gets there in time.

The calculations go through the device's time zone. On the night of the daylight saving time change, a clock hour is therefore not necessarily a real hour.

"Set a departure reminder" schedules a notification with AlarmManager. WorkManager is not suitable, because in Doze it can delay by minutes. The exact alarms permission is not declared: on Play it is reserved for alarm clocks and calendars. The reminder therefore uses setAndAllowWhileIdle, which in Doze can be late by a few minutes but is never skipped.

There is only one reminder at a time, saved in the preferences. After a device restart, a receiver schedules it again. If the time passed less than 30 minutes ago (device off at that moment), the notification appears immediately. The reminder is canceled with Start, on arrival and at every change of the route (start, destination, arrival time).

The notification permission is requested when needed. If Android no longer asks for it, or notifications are off, under "Notifications are off" a "Settings" button appears, which opens the app's page.

Turn-by-turn navigation

Start starts the navigation inside the Navigator tab. The screen has:

  • at the top, a card with the next turn (arrow, street name, distance) and the one after ("Then");
  • the map with the route, the destination marker and the ring at the starting point;
  • at the bottom, a panel with the time and distance remaining, the arrival time and the following turns.

End (a red X) closes the navigation. The mode (walking, biking, driving) is chosen before starting.

Map during navigation

The map rotates to the direction of travel, taken from the route 30 m ahead of the location. This way it does not jump at every bend, and before a turn it already rotates toward the following road. The location sits in the lower part of the screen, with more road ahead.

On the route, the location dot sits on the road, not where the GPS error moves it. Off the route or without a signal, the true location returns. The part of the route already done stays drawn in gray.

The zoom follows the next turn: near the intersection the map zooms in (zoom 17 under 150 m), on long roads it zooms out (down to 12 beyond 8 km).

Outside the downloaded region the map is not empty. Underneath are the borders of the countries included in the app and, with a connection, the world map (zoom 11 at most; beyond it shows nothing more). Inside the region the land is drawn by the region's earth layer, precise on the coasts.

Street names

BRouter segments do not have street names. They are taken from the downloaded map (roads layer): for each turn, the nearest road (within 15 m) at the midpoint of the stretch right after it.

Only the turns within 1.5 km of the location and in the visible area of the map are searched, because the tiles of distant turns are not loaded yet. Each turn has at most 3 attempts, with one search every 5 seconds. Turns outside that area do not use up attempts and get their name when they come close.

The search starts only when the map is still and drawn (OnDidBecomeIdle), not at the end of the camera movement. Reading the map's roads before it is drawn (querySourceFeatures) crashes MapLibre, with a SIGSEGV in the renderer.

Time remaining and delay

The time remaining comes from the BRouter times for each point of the route, not from the average speed. The times take into account road speed, slope and turns, but not traffic. This way, after a slow stretch in the city, the time left for the fast road is the right one. By car, the preview says it under the distance: "Estimated time without traffic".

With an arrival time chosen, the time remaining turns red with "X minutes late" if the arrival is no longer on time; otherwise "On time for HH:MM" appears.

GPS and background navigation

Navigation works only with GPS on. Without the location permission or with GPS off it does not start, and it stops if GPS is turned off. Until a recent location (from the last 10 seconds) arrives, "Waiting for GPS signal…" is shown, also in the notification. Only the device's GPS is used (LocationManager): no network and no Google Play Services.

Without GPS, for example on a tablet, the app does not crash when the Navigator is opened. Only the precise location permission is accepted.

Navigation continues with the screen off, in the background and with the app closed from the recent apps. Without a location-type foreground service, Android would limit locations for background apps and the navigation would stall. The service and the navigation controller live as long as the process, not the screen: their structure is described in Navigator in Architecture.

The background location permission is not needed, because the service starts only from a navigation started with the app open. Reopening the app opens the Navigator, attached to the navigation in progress. Navigation ends only with "End" (in the app or in the notification) or on arrival with "Turn off GPS on arrival".

The ongoing notification shows the first turn as soon as the route is calculated, without waiting for the next location. Then it shows turn, distance, street, time remaining and arrival time, with "End". On Android 16 it is a Live Update, with the distance in a status bar chip. Tapping it returns to the Navigator.

While the navigation is active, the activity shows above the lock screen (setShowWhenLocked), so it can be followed without unlocking the device. When the navigation is closed, the lock returns to normal.

In a tunnel, if the signal is lost, navigation and map stay with a message and the screen stays on.

Interrupted navigation

Destination, region, mode and arrival time of the navigation in progress are saved on the device. If the app is closed or the process killed, reopening it (also from the icon) shows "Resume navigation?" with Resume and No, for at most 12 hours.

Location on the route and recalculation

The navigation recalculates the route in three cases:

  • start in the wrong direction: the user moves more than 150 m away from the first point of the route;
  • off route: two consecutive locations beyond the threshold of the mode (30 m walking, 35 m by bike, 40 m by car, RouteProfile.offRouteMeters), with a GPS accuracy within 40 m, at most every 10 seconds;
  • after "Skip waypoint".

A single wrong location is not enough, so imprecise locations, typical in cities, do not cause constant recalculation. As long as the nearest point is the start of the route, the user is not off route: they are reaching the road the route starts from, for example from a pedestrian zone.

A recalculation from a location outside the regions with the road network does not call BRouter: the previous route stays. After a recalculation, the voice restarts from the new route.

Searching for the stretch

The location is searched near the furthest point already reached, so after a U-turn the location does not go back. The search window goes:

  • backward, up to 30 m: a stretch slightly behind wins only if it is closer by at least 1 m, so after a U-turn the return stretch stays;
  • forward, up to what can be covered from the previous location: the recent average speed times 1.5 plus 5 m/s, capped at the plausible speed of the mode (5 m/s walking, 15 by bike, 60 by car), plus 30 m of GPS error.

Forward, the search looks at the next 2 km at most, so on long routes each location costs little. The whole route is examined only when off route.

On switchbacks and out-and-back trails, an imprecise location thus does not jump to the other stretch of the same road, and the next instruction does not return to a turn already passed. In the tests with simulated GPS with 5 m of error (10 routes per mode), the instruction already passed never stays more than 20 m behind.

Waypoints and arrival

During navigation, under the time and distance there is "Next waypoint: " with "Skip waypoint". A waypoint is reached within the arrival threshold of its point on the route, or when the location is already past that point. The voice says "Waypoint reached: ", when walking the phone vibrates as on arrival, and the navigation continues on the same route.

"Skip waypoint" removes the waypoint and recalculates from the last location toward the others. Every recalculation goes through the waypoints not yet reached, which are also saved with the interrupted navigation.

The arrival triggers at 15 m from the end of the route when walking, 20 m by bike and 30 m by car, to leave room for parking. "Destination reached: " appears and the app returns to the search.

With "Turn off GPS on arrival" (Settings, on by default) the navigation closes and the GPS turns off immediately, also with the app in the background. With the option off, the navigation stays active until it is closed: only this option decides what happens on arrival.

The on-screen message is given only if the arrival was less than 2 minutes ago: reopening the app later, nobody is there to read it. Voice and vibration of the arrival come at the moment of arrival, also with the screen off.

Voice, vibration and TalkBack

Navigation can be followed without looking at the screen, with voice guidance, vibration when walking and TalkBack announcements: see Accessibility and voice.

Persistent notices

By car, if the route passes through a country where one drives on the other side compared with the user's nationality, a persistent notice points this out ("This country drives on the left"). From Italy to the United Kingdom the notice appears, to France it does not. Without a nationality, right-hand driving is assumed. The list of left-driving countries is fixed in the app.

By bike and by car (campers and motorcycles use the car), a persistent notice says that speed cameras, speed limits and restricted-traffic or low-emission zones are not shown, because the road network does not have them. The invitation to always follow the road signs is in bold. When walking, the notice does not appear.

In a wheelchair

When walking with "In a wheelchair", the route uses the wheelchair.brf profile: see Walking routes in a wheelchair.

Routes between two regions

With the start in one region, the arrival in a neighboring one and the road network of both downloaded, the route crosses the border. The segments of the two regions are joined on the device and the map shows both. If the region of the arrival or the start has no road network, the screen offers to download it.

Joining the segments

The regions are published on different days, so their segments come from different builds of brouter.de. When joining piece by piece (micro-cell), a road modified on the edge between the two builds may point to a node that no longer exists in the other. BRouter then does not route over it, and a route starting from there ends up on an island. With regions six days apart, the broken roads were 2 between Belgium and Hauts-de-France and 5 between Czechia and Austria.

For this reason Rd5Merger chooses the micro-cells of all the tiles together and moves the edges. Two neighboring micro-cells (even in different tiles) or joined by a road, taken from different regions, are fine if one of the two is identical in the two regions. Otherwise the micro-cell of the older region is taken. The roads are read with the BRouter decoder (BRouterRd5Links) only in the band where the cut-outs overlap.

On the same data the broken roads are 0. The join takes 1–3 seconds on the PC, once per combination of regions: the joined folder stays in the cache, and MERGE_VERSION in the key forces a new merge when the method changes.

If on the joined segments the start or the arrival stays isolated, FallbackRouteEngine looks for the route with each region alone.

On Oct 2, 2026, seven border routes (San Marino–Rimini, Chiasso–Como, Lugano–Ponte Tresa, Domodossola–Brig, Campione d'Italia–Lugano and others), on foot, by bike and by car, gave distances equal within one meter to those on the whole tile.

Simulated GPS in tests

In debug builds the calculated route is written to the log with the tag PocketTravelRoute, and the script tools/dev/simulate-route.js moves the emulator's GPS along the route. The route goes to the log on several lines because logcat truncates lines beyond about 4 KB (commands and format in the developer guide docs/GUIDA.md (Italian), section "Compilare e provare").

Clone this wiki locally