3 ms·
The simplest is to fetch the OSM tiles directly (and cache them!) imgurl = "https://a.tile.openstreetmap.org/{0}/{1}/{2}.png".format(zoom, xtile, ytile) th
by qwertox 5y ago
The simplest is to fetch the OSM tiles directly (and cache them!)
imgurl = "https://a.tile.openstreetmap.org/{0}/{1}/{2}.png".format(zoom, xtile, ytile)
the tricky part is to known which xtile, ytile to fetch, but Stack Overflow has the answer [1].
Then you can draw over them with `PIL` and also `cairo`, in order to lay SVG shapes onto the map. Cairo is somewhat hard to grasp, because it is outdated, but it draws perfectly smooth lines.
[1] https://stackoverflow.com/a/28530369 https://stackoverflow.com/a/28530369