# marceloprates/prettymaps architecture

> Architecture diagram of the GitHub repository marceloprates/prettymaps, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marceloprates/prettymaps
- Repository: https://github.com/marceloprates/prettymaps

## Overview

##### Main Components and Architecture

a) Core Components:
- Data Fetching Layer (fetch.py)
- Preset Management System
- Configuration Management

b) External Dependencies:
- OpenStreetMap (Data Source)
- osmnx (Map Data Processing)
- matplotlib (Visualization)
- shapely (Geometry Processing)
- vsketch (Plotter Mode)

##### Component Relationships

**[OpenStreetMap API] --> [Data Fetching Layer (fetch.py)]**

- v
**[Preset System] --> [Configuration Management]**

- v

- v
- [Multiple Output Formats]
- Standard Map View
- Plotter Mode (SVG)
- Custom Styling

##### Specific Implementation Details

a) Data Flow:
- Query Input (address/coordinates) → OSM Data Fetch → GeoDataFrame Processing → Visualization
- Preset Loading → Style Application → Final Rendering

b) Configuration Management:
- Preset System (JSON files in presets/ directory)
- Layer Configuration
- Style Parameters

##### Component Details

Each component should show:

- Component Name     |

- Key Functions        |
- Input/Output Types   |
- Dependencies         |

##### Implementation Notes

Technical details:
- GeoDataFrame processing
- Matplotlib integration
- SVG export capabilities
- Custom styling options

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        OSM[OpenStreetMap API]:::external
        OSMNX[osmnx Library]:::external
        MPL[matplotlib]:::external
        SHAP[shapely]:::external
        VSK[vsketch]:::external
    end

    subgraph Core["Core Components"]
        FETCH[Data Fetching Layer]:::core
        DRAW[Drawing Layer]:::core
        MAIN[Main Package Interface]:::core
        
        subgraph PresetSystem["Preset Management System"]
            PRES[Preset Manager]:::core
            DEF["Default Preset"]:::preset
            PLOT["Plotter Preset"]:::preset
            CONF["Configuration Management"]:::core
        end
    end

    subgraph Output["Output Renderers"]
        STD["Standard Map View"]:::output
        PLT["Plotter Mode (SVG)"]:::output
        CUST["Custom Styling"]:::output
    end

    %% Data Flow
    OSM --> FETCH
    OSMNX --> FETCH
    FETCH --> DRAW
    SHAP --> DRAW
    MPL --> DRAW
    VSK --> DRAW
    
    %% Preset System Flow
    PRES --> CONF
    DEF --> PRES
    PLOT --> PRES
    CONF --> DRAW
    
    %% Output Flow
    DRAW --> STD
    DRAW --> PLT
    DRAW --> CUST
    
    MAIN --> FETCH
    MAIN --> DRAW

    %% Click Events
    click FETCH "https://github.com/marceloprates/prettymaps/blob/main/prettymaps/fetch.py"
    click DRAW "https://github.com/marceloprates/prettymaps/blob/main/prettymaps/draw.py"
    click PRES "https://github.com/marceloprates/prettymaps/tree/main/prettymaps/presets/"
    click DEF "https://github.com/marceloprates/prettymaps/blob/main/prettymaps/presets/default.json"
    click PLOT "https://github.com/marceloprates/prettymaps/blob/main/prettymaps/presets/plotter.json"
    click MAIN "https://github.com/marceloprates/prettymaps/blob/main/prettymaps/__init__.py"

    %% Styling
    classDef external fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef preset fill:#FFA500,stroke:#333,stroke-width:2px
    classDef output fill:#FFB6C1,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        EXT[External Dependencies]:::external
        CORE[Core Components]:::core
        PSET[Preset Files]:::preset
        OUT[Output Types]:::output
    end
```
