Get exif data for all files in a folder

Goal: Generate a json for every folder with all the gps data of all the images in the folder.

import json
from exif import get_location
from pathlib import Path
import exifread

base = Path("images")
for folder in sorted(base.glob("201*")):
    if folder.is_dir():
        gps_data = {}
        json_fn = folder / "gps.json"
        if json_fn.exists():
            continue
        for fn in sorted(folder.glob("*.JPG"):
            with open(folder / fn, "rb") as f:
               gps_data[fn.name] = get_location(exifread.process_file(f))
        if gps_data:
           json.dump(gps_data, open(json_fn, "w"))

this code uses get_location from this blog post: https://madflex.de/posts/get-gps-data-from-images/

Plot on an OSM map using Python

I want to plot a circle (and later possible a lot of circles) on a static openstreetmap map.
The library best suited seems staticmap from komoot: https://github.com/komoot/staticmap

This code plots a circle on a map of Stuttgart-Vaihingen:

from staticmap import StaticMap, CircleMarker
m = StaticMap(200, 200)

marker = CircleMarker((9.1065541, 48.7324794), '#0036FF', 5)
m.add_marker(marker)

image = m.render(zoom=15)
image.save('marker.png')

I want to generate quite some images on a large map so I added a cache to the tiles system in staticmap: https://github.com/mfa/staticmap/commit/4f922e913d6a3976c645e3b7551af441880763a5