mirror of
https://github.com/marceloprates/prettymaps.git
synced 2026-02-01 11:33:22 +01:00
1.3 KiB
1.3 KiB
Usage
Basic Usage
The main entry point is the plot() function:
import prettymaps
prettymaps.plot("Porto Alegre")
This will generate a map for the given location using default layers and styles.
Customizing Layers and Styles
You can customize which OpenStreetMap layers are shown and how they are styled:
layers = {
"perimeter": {},
"streets": {"width": 8},
"buildings": {},
}
style = {
"perimeter": {"fc": "#f2efe9"},
"streets": {"fc": "#cccccc", "ec": "#333333"},
"buildings": {"fc": "#bdbdbd"},
}
prettymaps.plot("Porto Alegre", layers=layers, style=style)
Using Presets
Presets are reusable configurations for layers and styles. You can load, save, or update presets:
prettymaps.plot("Porto Alegre", preset="default")
You can also create your own presets and save them for later use.
Highlighting Keypoints
You can highlight specific keypoints (e.g., landmarks) on the map:
keypoints = {
"tags": {"tourism": "attraction"},
"kwargs": {"bbox": {"fc": "yellow"}},
}
prettymaps.plot("Porto Alegre", keypoints=keypoints)
Saving Maps
You can save the generated map to a file:
prettymaps.plot("Porto Alegre", save_as="map.png")
See the API Reference for details on all functions and parameters.