Skip to main content

Standalone Python CLI for generating styled OSM map posters as PNG and SVG.

Project description

The repo is python version of terraink

中文文档 now also ships a standalone Python renderer that skips the website entirely and writes map posters directly to png and svg.

telegram-cloud-photo-size-5-6156580721556917384-y

Installation

Install from PyPI:

pip install terraink_py

Or with uv (recommended for CLI tools):

uv tool install terraink_py

Usage

Generate a poster from a place name:

terraink \
  "Ganjingzi District, China" \
  --theme midnight_blue \
  --layout print_a4_portrait \
  --language en \
  --distance-m 4000 \
  --format png svg \
  --output outputs/ganjingzi

--location "..." still works; the positional argument is just a shorter alias.

To overlay routes from a running_page parquet, pass the repo slug or parquet URL:

terraink "Dalian" --running_page yihong0618/run --output outputs/dalian-run

When --running_page is set, the default --distance-m becomes 12000 unless you override it explicitly.

Development

Use uv in this repo:

uv sync --all-groups

Run the shared checks with prek:

uv run prek run --all-files

Then run via:

uv run terraink --help

Generate from coordinates in Python code:

from pathlib import Path

from terraink_py import PosterRequest, generate_poster

result = generate_poster(
    PosterRequest(
        output=Path("outputs/ganjingzi"),
        formats=("png", "svg"),
        lat=38.862405,
        lon=121.513525,
        title="Ganjingzi District",
        subtitle="China",
        theme="midnight_blue",
        width_cm=21,
        height_cm=29.7,
        distance_m=4000,
        include_buildings=True,
    )
)

print(result.files)

Notes:

  • The Python renderer uses Nominatim + Overpass directly, so it is designed for city and regional posters rather than world-scale exports.
  • svg output is true vector geometry, not a browser screenshot wrapped in SVG.
  • Place label language defaults to auto-detect from your title/subtitle/query. Use --language en or --language zh to override it.
  • Chinese place names now auto-fallback to common CJK system fonts on macOS/Linux; if your machine still lacks glyph coverage, pass --font-file /path/to/font.ttf.
  • The PyPI package name is terraink_py, while the CLI command is terraink.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

terraink_py-0.6.1.tar.gz (48.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

terraink_py-0.6.1-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file terraink_py-0.6.1.tar.gz.

File metadata

  • Download URL: terraink_py-0.6.1.tar.gz
  • Upload date:
  • Size: 48.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for terraink_py-0.6.1.tar.gz
Algorithm Hash digest
SHA256 d38c0801745e957b715300efdc491c529135f7a490076d55a0418e624ec2d6a8
MD5 ffa7d874d86e9a205f319f18ad2a27d1
BLAKE2b-256 9562bc1fcf69362991272abc62ce95d73f001cd537746f297a2ff509b3a4d2c6

See more details on using hashes here.

File details

Details for the file terraink_py-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: terraink_py-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for terraink_py-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb60d4823ec17504741f736cac3b0615799e832320936118c0fe56a39fd840fe
MD5 f59794ce07e7c2d51105fdb8538068c1
BLAKE2b-256 435fc4938c51c70d303d299dec4dda2ecc2d87f050d3be0eec0080057c11343f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page