<h1>
  MapsApp
  <a href="https://bpev.me/apps">
    <img src="https://static.bpev.me/icons/made-by-ben.svg" />
  </a>
</h1>

MapsApp is an offline-capable geomap, meant for storing location bookmarks.

It is a PWA built on [MapLibre GL](https://maplibre.org) and [PMTiles](https://protomaps.github.io), and serves as a proof-of-concept for the data flow behind something like [Organic Maps](https://organicmaps.app). A world basemap is fetched on first load, users can download regional tiles on demand with additional detail, and everything renders offline after that. Bookmarks, lists, and search history are stored locally, and a list can be shared as a public link.

![Screenshot](./www/static/brand/screenshot.png)

![Screenshot](./www/static/brand/screenshot-desktop.png)

## Technologies

**App**

- **[maplibre-gl](https://maplibre.org)** — vector tile rendering engine
- **[pmtiles](https://protomaps.github.io)** — single-file tile archive format; enables serving maps from static files with no tile server
- **[pmtiles-offline](https://github.com/jtbaker/pmtiles-offline)** — utility for serving pmtiles from local data
- **[nominatim](https://nominatim.org)** - api for geocoding
- **[civility](https://jsr.io/@civility)** — PWA build system, service worker framework, router, and state management
- **[lit](https://lit.dev)** — reactive web components for route views
- **[deno](https://deno.com)** — runtime and toolchain

**Tile creation** — see [data/README.md](data/README.md) for the full pipeline.

## Development

Running the app requires [Deno](https://deno.com) and [Civility](https://jsr.io/@civility/cli):

```sh
curl -fsSL https://deno.land/install.sh | sh
deno install -gA jsr:@civility/cli --name civ
```

Before running the app, you need tiles, built via the [CLI](data/README.md):

```sh
deno task data list
# First, download or extract osm files to /data/osm
deno task data download:osm europe/spain
deno task data extract europe/spain --from planet

# Then build pmtiles
deno task data build europe/spain
```

The you can then serve or build the app with Civility CLI:

```sh
civ start # Start a server with hot reload
civ build # Builds static files to serve from /www
```

**Lint and type-check:**

```sh
deno task test
```
