diff --git a/docs/controller/services.md b/docs/controller/services.md index 6a2220f..b05cd5d 100644 --- a/docs/controller/services.md +++ b/docs/controller/services.md @@ -13,6 +13,7 @@ The following services are managed by the Controller: | wrolpi-app | 3000 | React frontend application | | wrolpi-help | 8086 | Documentation server | | wrolpi-kiwix | 8085 | Offline wiki server (Kiwix) | +| wrolpi-tiles | 8088 | [Map tiles for ATAK and iTAK](../modules/map/atak.md) | | caddy | 80/443 | Web server and reverse proxy | | smbd / nmbd | 445 | Samba file sharing | diff --git a/docs/index.md b/docs/index.md index b1e4438..183d964 100644 --- a/docs/index.md +++ b/docs/index.md @@ -47,6 +47,7 @@ Information about the parts of the WROLPi interface. * [Overlays](modules/map/overlays.md) * [Exporting a Map as a PDF](modules/map/export.md) * [Fallout Simulator](modules/map/fallout.md) + * [ATAK and iTAK](modules/map/atak.md) * [Zim](modules/zim/index.md) * [Repos](modules/repos/index.md) * [Bookmarks](modules/bookmarks/index.md) diff --git a/docs/modules/map/atak-tab.png b/docs/modules/map/atak-tab.png new file mode 100644 index 0000000..b149a7b Binary files /dev/null and b/docs/modules/map/atak-tab.png differ diff --git a/docs/modules/map/atak-tile-service.png b/docs/modules/map/atak-tile-service.png new file mode 100644 index 0000000..45bc723 Binary files /dev/null and b/docs/modules/map/atak-tile-service.png differ diff --git a/docs/modules/map/atak.md b/docs/modules/map/atak.md new file mode 100644 index 0000000..4113e9a --- /dev/null +++ b/docs/modules/map/atak.md @@ -0,0 +1,115 @@ +# ATAK and iTAK + +WROLPi can be a map source for ATAK (Android) and iTAK (iPhone). A phone on your WROLPi's network +draws your WROLPi's map, and can download an area of it to use when it is away. + +ATAK and iTAK draw maps made of pictures (raster tiles), but your map files are not pictures: the +map in your browser is drawn from them as you look at it. So WROLPi has a tile service that draws the +pictures these apps ask for, from the [map files](files.md) you already have. It works without the +Internet. + +![The ATAK tab](atak-tab.png) + +## Adding the Map to ATAK or iTAK + +> To add the map to ATAK or iTAK, open the **Map** page, then the **ATAK** tab. On the phone, open one +> of the map source addresses in the phone's browser, then open the file it downloads with ATAK or +> iTAK. + +1. On the phone, open a map source address from the ATAK tab in the phone's browser. It downloads a + small file, `wrolpi-map.xml`. +2. Open that file with ATAK or iTAK, or import it with the app's import tool. +3. Choose **WROLPi Map** in the app's list of maps. + +There are two map sources. Use HTTP unless you need HTTPS: + +| Map source | Address | What it needs | +|------------|---------|---------------| +| **HTTP** | `http://your-wrolpi:8088/tiles/wrolpi.xml` | Nothing. Works on any phone. | +| **HTTPS** | `https://your-wrolpi/tiles/wrolpi.xml` | The phone must trust your WROLPi's certificate (below). It is called **WROLPi Map (HTTPS)** in the app. | + +The addresses on the ATAK tab are made from the address your browser used to open WROLPi. The phone +must be able to reach that address too: open the ATAK tab on the phone itself, or make sure the +phone is on the same network (or your WROLPi's [hotspot](../../controller/system.md#wifi-hotspot-raspberry-pi)). + +### HTTPS + +For the HTTPS map source, the phone must trust your WROLPi's certificate first. The ATAK tab links +to it (**this WROLPi's certificate**); see [Installing the Certificate](../../system/certificates.md#installing-the-certificate) +for each kind of phone. On an iPhone, do not miss the last step, turning on full trust in +**Certificate Trust Settings**. + +Clicking through the browser's warning is not enough: the app does not trust a certificate the +browser was told to accept. If the map does not load over HTTPS, use the HTTP map source. + +## Taking an Area Offline + +Both ATAK and iTAK can download an area of the map to the phone, so the map works when the phone is +away from your WROLPi. + +> To take an area offline, choose **WROLPi Map** in the app, then use the app's map download tool to +> choose the area and zoom levels, while the phone is still connected to your WROLPi. + +- The map goes to zoom 17 (individual buildings). Each zoom level has four times the tiles of the one + before it, so the deepest zoom levels are most of a download. +- A town-sized area from zoom 12 to 17 was about 120,000 tiles, and took about 24 minutes from a + Raspberry Pi 4. +- Tiles already drawn for one phone are sent at once to the next (see + [Kept Tiles](#kept-tiles)), so a second phone taking the same area is much faster. +- A tile your WROLPi could not draw in time is not sent: the app is asked to try that tile again, + so no tile is missing from what the phone keeps. + +## What the Map Shows + +The map in ATAK and iTAK is the map you see on the Map tab, in its light colors: + +- Every **basemap** file on the [Manage tab](files.md), over the world overview your WROLPi comes + with. Map files you hide on the Manage tab are not drawn. +- Not [terrain](terrain.md) (hillshade and contours), [overlays](overlays.md), or imagery. +- When you add, replace, hide, or remove a map file, the map changes within half a minute. A phone + keeps the tiles it already has (ATAK for at least a week); to see the change on the phone, download + the area again. + +Map data is © OpenStreetMap contributors. + +## The Tile Service + +The **Tile service** panel of the ATAK tab shows what the tile service is doing. + +![The tile service panel](atak-tile-service.png) + +| Row | What it means | +|-----|---------------| +| **Map files** | How many map files the tiles are drawn from (the world overview counts as one). | +| **Tiles sent** | How many tiles phones are getting each second, over the last minute. | +| **Waiting to be drawn** | Tiles waiting to be drawn, in blocks of 16: the tile service draws 16 neighboring tiles at once. | +| **Kept tiles** | How much of the disk the kept tiles take, of the most they may (see below). | +| **Phones (last day)** | Each phone that asked for tiles in the last day, how many it got, and when. | + +If the panel says **The tile service is not running**, start **wrolpi-tiles** on the +[Controller](../../controller/services.md) page. + +### Kept Tiles + +The tile service keeps the tiles it draws, so a tile asked for again (by any phone) is sent at once. + +- They are kept on your WROLPi's own disk (`/var/cache/wrolpi-tiles`), not on your media drive, so + they are not part of your library or its backups. +- At most 1 GB is kept; the oldest are removed to make room. Nothing is kept while the disk has less + than 2 GB free. +- Kept tiles are removed when your map files change: they are of the old map. + +> To clear the kept tiles, click **Clear** beside **Kept tiles**, then **Clear**. + +Clearing frees the disk; the tiles are drawn again when a phone next asks for them. Maps already +downloaded to phones are not changed: a phone keeps its own copy. + +### How It Works + +- The tile service is **wrolpi-tiles**, a service of its own, apart from the rest of WROLPi. It gets + less of the processor than WROLPi itself, so a phone taking an area offline does not slow WROLPi + down for you. +- It draws with the Raspberry Pi's graphics processor when it can. A Raspberry Pi 4 draws about 30 + new tiles a second. +- It serves plain HTTP on port `8088`, and HTTPS at `/tiles/` on the usual port (`443`). +- In Docker, it is the `tiles` container. diff --git a/docs/modules/map/index.md b/docs/modules/map/index.md index daf030c..f4eb5ea 100644 --- a/docs/modules/map/index.md +++ b/docs/modules/map/index.md @@ -15,6 +15,7 @@ self-hosting vector maps from a single PMTiles file. | [Overlays](overlays.md) | Drawing your own data over the map: power lines, trails, imagery, and their styles and icons. | | [Exporting a Map as a PDF](export.md) | Printing a 1:24,000 topographic sheet, or carrying it on a phone. | | [Fallout Simulator](fallout.md) | Where the fallout of nuclear bursts would land, hour by hour, and the weather forecast it uses. | +| [ATAK and iTAK](atak.md) | The ATAK tab: adding your map to ATAK or iTAK, taking an area offline, and the tile service. | ## Map Tab @@ -100,6 +101,11 @@ The targets saved by the [fallout simulator](fallout.md) are listed in their own pins, with each target's weapon, coordinates, and when it was saved. Click the coordinates to fly the map there, or delete a target. They are kept in `map_nuclear.yaml`, apart from your pins. +## ATAK Tab + +The ATAK tab adds your map to ATAK (Android) and iTAK (iPhone), and shows what the tile service is +doing. See [ATAK and iTAK](atak.md). + ## Manage Tab The Manage tab lists your map files and your map subscriptions (see [Map Files](files.md)), and the