Dynamical system model
Loading...
Searching...
No Matches
cartography Namespace Reference

Functions

tuple|nx.MultiDiGraph get_cartography (str place_name, str network_type="drive", bool|float consolidate_intersections=10, bool dead_ends=False, str return_type="gdfs")
 

Detailed Description

@file cartography.py
@brief Cartography utilities for retrieving and processing OpenStreetMap data.

This module provides functions to download and process street network data
from OpenStreetMap using OSMnx, with support for graph simplification and
standardization of attributes.

Function Documentation

◆ get_cartography()

tuple | nx.MultiDiGraph cartography.get_cartography ( str place_name,
str network_type = "drive",
bool | float consolidate_intersections = 10,
bool dead_ends = False,
str return_type = "gdfs" )
Retrieves and processes cartography data for a specified place using OpenStreetMap data.

This function downloads a street network graph for the given place, optionally consolidates
intersections to simplify the graph, removes edges with zero length, self-loops and isolated nodes,
and standardizes the attribute names in the graph. Can return either GeoDataFrames or the graph itself.

Args:
    place_name (str): The name of the place (e.g., city, neighborhood) to retrieve cartography for.
    network_type (str, optional): The type of network to retrieve. Common values include "drive",
        "walk", "bike". Defaults to "drive".
    consolidate_intersections (bool | float, optional): If True, consolidates intersections using
        a default tolerance. If a float, uses that value as the tolerance for consolidation.
        Set to False to skip consolidation. Defaults to 10.
    dead_ends (bool, optional): Whether to include dead ends when consolidating intersections.
        Only relevant if consolidate_intersections is enabled. Defaults to False.
    return_type (str, optional): Type of return value. Options are "gdfs" (GeoDataFrames) or
        "graph" (NetworkX MultiDiGraph). Defaults to "gdfs".

Returns:
    tuple | nx.MultiDiGraph: If return_type is "gdfs", returns a tuple containing two GeoDataFrames:
        - gdf_edges: GeoDataFrame with processed edge data, including columns like 'source',
          'target', 'nlanes', 'type', 'name', 'id', and 'geometry'.
        - gdf_nodes: GeoDataFrame with processed node data, including columns like 'id', 'type',
          and 'geometry'.
        If return_type is "graph", returns the NetworkX MultiDiGraph with standardized attributes.