summaryrefslogtreecommitdiff
path: root/ero1/src/generation/graph_generation.py
blob: 641e76181230cbb9ec60a092b5a126a790182b33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import osmnx as ox
from src.helper.duplicate_removal import remove_duplicates

def generate_graph(city_name, debug_mode=False):
    """
    Génère un graphe à partir du nom d'une ville en utilisant OSMnx.

    Parameters:
        city_name : Le nom de la ville pour laquelle générer le graphe.

    Returns:
        MultiDiGraph : Le graphe généré.
    """
    # Generate the graph from the city name
    GRAPH = ox.graph_from_place(city_name, network_type='drive')
    GRAPH = remove_duplicates(GRAPH, debug_mode)
    return GRAPH