Skip to content

Presets

satprint.presets

Named example areas for the web UI.

Each entry is a center and a square size in km; :func:presets turns them into bounding boxes. City areas are kept to a few km so their buildings stay printable and the Overpass download stays small.

around(lat, lon, size_km)

Square bbox [S, W, N, E] of size_km centered on (lat, lon).

Source code in satprint/presets.py
90
91
92
93
94
95
96
97
98
99
def around(lat: float, lon: float, size_km: float) -> list[float]:
    """Square bbox [S, W, N, E] of ``size_km`` centered on (lat, lon)."""
    dlat = size_km / 2 / 111.32
    dlon = size_km / 2 / (111.32 * math.cos(math.radians(lat)))
    return [
        round(lat - dlat, 5),
        round(lon - dlon, 5),
        round(lat + dlat, 5),
        round(lon + dlon, 5),
    ]

presets()

All presets, cities first. buildings is the suggested default.

Source code in satprint/presets.py
102
103
104
105
106
107
108
109
110
111
112
113
114
115
def presets() -> list[dict]:
    """All presets, cities first. ``buildings`` is the suggested default."""
    out = []
    for group, rows, buildings in ((CITIES, _CITIES, True), (NATURE, _NATURE, False)):
        for name, lat, lon, km in rows:
            out.append(
                {
                    "name": name,
                    "group": group,
                    "bbox": around(lat, lon, km),
                    "buildings": buildings,
                }
            )
    return out