gboeing / osmnx

OSMnx is a Python package to easily download, model, analyze, and visualize street networks and other geospatial features from OpenStreetMap.
https://osmnx.readthedocs.io
MIT License
4.89k stars 827 forks source link

InsufficientResponseError while #1177

Closed e183b796621afbf902067460 closed 5 months ago

e183b796621afbf902067460 commented 5 months ago

Contributing guidelines

Documentation

Existing issues

What operating system and Python version are you using?

Ubuntu 22.04.4 LTS/Python 3.10

What OSMnx version are you using?

1.9.2

Environment packages and versions

Package                   Version
------------------------- ---------------
geopandas                 0.14.2
geopy                     2.4.1
networkx                  3.2.1
numpy                     1.26.3
osmnx                     1.9.2
pandas                    2.1.4
pyproj                    3.6.1
shapely                   2.0.4

How did you install OSMnx?

Pip

Problem description

Got InsufficientResponseError on one osmnx.settings.overpass_url but a good one on another.

Complete minimal reproducible example

import osmnx as ox
import shapely
import geojson
import networkx as nx
import pandas as pd
import geopandas as gpd
from osmnx._errors import InsufficientResponseError

def _create_directed_graph_by_de(
    x: float,
    y: float,
    distance: int = 2500,
    adjustment: int = 200
) -> nx.MultiDiGraph:
    ox.settings.overpass_url = 'https://overpass-api.de/api'
    ox.settings.overpass_rate_limit = False

    return ox.graph_from_point((y, x), dist=distance + adjustment)

def _create_directed_graph_by_ru(
    x: float,
    y: float,
    distance: int = 2500,
    adjustment: int = 200
) -> nx.MultiDiGraph:
    ox.settings.overpass_url = 'https://maps.mail.ru/osm/tools/overpass/api/'
    ox.settings.overpass_rate_limit = False

    return ox.graph_from_point((y, x), dist=distance + adjustment)

try:
    graph_ru = _create_directed_graph_by_ru(x=39.703622, y=54.62859)
except InsufficientResponseError:
    ...
graph_de = _create_directed_graph_by_de(x=39.703622, y=54.62859)
ox.plot.plot_graph(graph_de)
gboeing commented 5 months ago

Your code runs fine on my computer. Both methods produce a graph with 6,429 nodes. It was probably a connectivity issue with the server when you first ran it, and seems to be resolved on their end now.