Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test

on:
push:
branches: [master]
branches: [main]
pull_request:

jobs:
Expand Down
55 changes: 36 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
# map-printer
# Map Printer

Export maps in the browser.
Map Printer exports print-resolution PNGs of a map area entirely in the
browser. The page is rendered as a grid of tiles in a hidden MapLibre map and
streamed row by row through a PNG encoder straight to a download, so the output
can be far larger than fits in memory. It takes a MapLibre style URL, a raster
XYZ tile template, a TileJSON URL, or a Mapbox style with an access token.

Download massive hi-res PNGs from map styles without memory limits.

This is a rewrite in progress: the app is being rebuilt on Vite + TypeScript
and MapLibre. See [docs/architecture.md](docs/architecture.md) for the design.
The old build at [map-printer.ddem.us](https://map-printer.ddem.us/) is the
previous version; a new deploy target is coming.
Live at [map-printer.comapeo.app](https://map-printer.comapeo.app).

## Usage

```
git clone https://github.com/digidem/map-printer.git
npm install
npm run dev # dev server
npm run build # production build to dist/
npm test # unit tests
```
Open the site, paste a map style or tile URL, set the bounding box to print,
the page size in mm and the target print DPI, tick the box confirming you will
include the attribution shown, and export. The PNG downloads as it is rendered.

## Deployment
Whatever you print must respect the licence of the map data you use, and
Mapbox styles are additionally subject to the Mapbox Terms of Service.

## Development

```bash
npm run deploy # build + deploy to Cloudflare Workers (static assets)
npm install # Install dependencies
npm run dev # Start dev server (Vite)
npm run build # Production build
npm run preview # Preview production build locally
npm run typecheck # tsc --noEmit
npm test # Unit tests (Vitest)
npm run test:e2e # Playwright e2e tests
npm run test:e2e:install # Install the e2e browsers (once)
```

Deploys to a `workers.dev` subdomain; a custom domain will be configured later.
See [docs/architecture.md](docs/architecture.md) for the module layout and the
contract each module exposes.

## Deployment

The site is served as Cloudflare Worker static assets. Pushes to `main` deploy
automatically and pull requests get a preview URL; `npm run deploy` builds and
deploys manually.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

## License
MIT

MIT — see [LICENSE](LICENSE).
12 changes: 8 additions & 4 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,11 @@ worker or WebGL2) get a message instead of a form. Safari 16.4+, Chrome

## Deployment

`wrangler.jsonc` serves `dist/` as static assets on `workers.dev` (no worker
script). `public/_headers` sets `Cache-Control: no-cache` on `sw.js`,
`index.html` and `/` so a new service worker propagates immediately.
`npm run deploy` builds and deploys.
The site is served at https://map-printer.comapeo.app as Cloudflare Worker
static assets: `wrangler.jsonc` serves `dist/` on that custom domain, with no
worker script. Pushes to `main` deploy automatically through Cloudflare's
Workers Builds, and pull requests get a preview URL; that connection is
configured in the Cloudflare dashboard rather than in this repo.
`public/_headers` sets `Cache-Control: no-cache` on `sw.js`, `index.html` and
`/` so a new service worker propagates immediately. `npm run deploy` still
builds and deploys manually with wrangler.
7 changes: 6 additions & 1 deletion wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
"$schema": "node_modules/wrangler/config-schema.json",
"name": "map-printer",
"compatibility_date": "2026-09-17",
"workers_dev": true,
"routes": [
{ "pattern": "map-printer.comapeo.app", "custom_domain": true },
],
"workers_dev": false,
// Defaults to workers_dev; PR previews need it on explicitly.
"preview_urls": true,
"assets": {
"directory": "./dist",
},
Expand Down