[
    {
        "role": "user",
        "content": "when%20we%20use%20osmnx%20ox.graph.graph_from_bbox%2C%20what%20are%20the%20parameters%20and%20types%20including%20bbox%20and%20its%20type%20and%20coordinate%20order%3F"
    },
    {
        "role": "assistant",
        "content": "Here\u2019s a detailed overview of the `osmnx.graph.graph_from_bbox` function (as of OSMnx v2.x), including its parameters, types, the bounding-box coordinate order, and related behavior.  \n\n---\n\n### Function signature\n\nIn OSMnx v2 (current stable versions), the signature for `ox.graph.graph_from_bbox` is approximately:\n\n```python\nox.graph.graph_from_bbox(\n    bbox: tuple[float, float, float, float],\n    *,\n    network_type: str = 'all',\n    simplify: bool = True,\n    retain_all: bool = False,\n    truncate_by_edge: bool = False,\n    custom_filter: Optional[Union[str, list[str]]] = None\n) -> networkx.MultiDiGraph\n```\n\nThis means:\n\n- `bbox` is the only positional argument.\n- The rest are keyword-only arguments (i.e. you must supply them with names).\n\n([app.readthedocs.org](https://app.readthedocs.org/projects/osmnx/downloads/pdf/stable/?utm_source=openai))\n\n---\n\n### Parameter details\n\nHere are the parameters, their types, and how they work:\n\n| Parameter | Type | Description |\n|---|---|---|\n| `bbox` | `tuple[float, float, float, float]` | The bounding box defining the geographic area. Format: **(left, bottom, right, top)**, i.e. **(west, south, east, north)**, in unprojected lat-long coordinates (EPSG:4326). ([app.readthedocs.org](https://app.readthedocs.org/projects/osmnx/downloads/pdf/stable/?utm_source=openai)) |\n| `network_type` | `str` | One of predefined network types (e.g. `\"all\"`, `\"all_private\"`, `\"drive\"`, `\"drive_service\"`, `\"bike\"`, `\"walk\"`). This selects the kind of ways (streets, routes, etc.) to include. Only used if `custom_filter` is None. ([aetperf.github.io](https://aetperf.github.io/2024/01/31/Create-a-routable-pedestrian-network-with-elevation.html?utm_source=openai)) |\n| `simplify` | `bool` | If `True`, simplifies the graph\u2019s geometry (e.g. removing unnecessary nodes along straight segments) using `simplify_graph`. ([aetperf.github.io](https://aetperf.github.io/2024/01/31/Create-a-routable-pedestrian-network-with-elevation.html?utm_source=openai)) |\n| `retain_all` | `bool` | If `True`, returns the whole graph even if not fully connected; if `False`, only the largest weakly connected component is returned. ([app.readthedocs.org](https://app.readthedocs.org/projects/osmnx/downloads/pdf/stable/?utm_source=openai)) |\n| `truncate_by_edge` | `bool` | If `True`, includes nodes outside the bbox if at least one neighbor is inside; otherwise, nodes strictly outside are dropped. Useful if you want edges that cross the bbox boundary. ([aetperf.github.io](https://aetperf.github.io/2024/01/31/Create-a-routable-pedestrian-network-with-elevation.html?utm_source=openai)) |\n| `custom_filter` | `str` or `list[str]` | If provided, overrides `network_type` by using your own Overpass query filter(s). Can be a single string or a list of strings. ([gis.stackexchange.com](https://gis.stackexchange.com/questions/340681/getting-pedestrian-network-with-osmnx?utm_source=openai)) |\n\n---\n\n### Bounding box (`bbox`) format and coordinate order\n\n- `bbox` must be a tuple of four floats: `(left, bottom, right, top)`, which corresponds to `(west, south, east, north)`.  \n- Coordinates are in **latitude-longitude degrees** (unprojected; EPSG:4326), not meters or a projected CRS.  \n- In practice, `left` = `west` longitude, `bottom` = `south` latitude, `right` = `east` longitude, `top` = `north` latitude. ([app.readthedocs.org](https://app.readthedocs.org/projects/osmnx/downloads/pdf/stable/?utm_source=openai))\n\n---\n\n### Examples\n\n```python\nimport osmnx as ox\n\n# Define bbox as (west, south, east, north)\nbbox = (-122.43, 37.78, -122.41, 37.79)  # Western SF neighborhood\n\n# Get a graph of drivable roads within that bbox\nG = ox.graph_from_bbox(\n    bbox=bbox,\n    network_type=\"drive\",\n    simplify=True,\n    retain_all=False,\n    truncate_by_edge=False\n)\n```\n\nIf using positional argument syntax (still accepted):\n\n```python\nG = ox.graph_from_bbox(bbox, network_type=\"walk\", retain_all=True)\n```\n\nNote: In earlier versions (pre-2.0), `graph_from_bbox` accepted four separate positional arguments: `north, south, east, west`. In v2 and later, this form is deprecated and many examples incorrectly still use it. ([stackoverflow.com](https://stackoverflow.com/questions/79270538/the-osmnx-call-graph-from-bbox-reports-that-it-takes-1-positional-argument-ho?utm_source=openai))\n\n---\n\n### What it returns\n\n- A `networkx.MultiDiGraph` (directed multigraph), where nodes are OSM nodes, edges are OSM ways (or parts of ways).\n- Node and edge attributes include geometry (lat, lon, etc.), OSM tags, and other metadata.\n- If `simplify=True`, the network topology is simplified: many degree-2 nodes along straight spans are collapsed unless needed for geometry. ([app.readthedocs.org](https://app.readthedocs.org/projects/osmnx/downloads/pdf/stable/?utm_source=openai))\n\n---\n\nIf you want, I can also show differences or gotchas between versions, or how `custom_filter` combines with `network_type`."
    }
]