Questions tagged [osmnx]

OSMnx is a Python package to download, model, analyze, and visualize street networks and other geospatial features from OpenStreetMap. You can download and model walking, driving, or biking networks with a single line of code then easily analyze and visualize them. You can just as easily work with urban amenities/points of interest, building footprints, transit stops, elevation data, street orientations, speed/travel time, and routing.

OSMnx is a package to download, model, analyze, and visualize street networks and other geospatial features from . OSMnx is built on top of and . You can download and model walking, driving, or biking networks with a single line of code then easily analyze and visualize them. You can just as easily work with urban amenities/points of interest, building footprints, transit stops, elevation data, street orientations, speed/travel time, and routing.

596 questions
0
votes
1 answer

Get all nodes inside only one of the Polygons, OSMNX

I have a network formed with two Polygons and I want to now which nodes are only in the bigger Polygon. How can I do this? Here is the code: import osmnx as ox import igraph as ig import matplotlib.pyplot as plt import pandas as pd import networkx…
DPM
  • 845
  • 7
  • 33
0
votes
1 answer

cmap.set_under() and cmap.set_over() not appearing in colorbar

I am trying to plot a color bar and I tried using cmap.set_under() and cmap.set_over(), however they do not appear on the plot, can anyone help me please? Here is the code: city = 'Portugal, Lisbon' G = ox.graph_from_place(city,…
DPM
  • 845
  • 7
  • 33
0
votes
1 answer

Adding an attribute to a node in osmnx

I am trying to add an attribute to my nodes in the osmnx network I have in order to use the ox.plot.get_node_colors_by_attr() later on. However I am unable to properly add the attribute. Here is the code: city = 'Portugal, Lisbon' G =…
DPM
  • 845
  • 7
  • 33
0
votes
0 answers

ValueError: 'vertices' must be a 2D list or array with shape Nx2 (Matplotlib)

I'm trying to plot the network for a place where I want to check accessibility of my friends for me. GDF I'm using: bbox = [12.8881, 77.5079, 12.9918, 77.6562] def make_gdf(file_name): shp = pd.read_csv(os.path.join(pth, file_name)) shp =…
0
votes
0 answers

TypeError: argument of type 'CRS' is not iterable

I'm trying to create network for a place where I want to check accessibility of my friends to me. Importing libraries(all latest versions) import warnings warnings.filterwarnings("ignore") import pandas as pd from pandana.loaders import osm import…
0
votes
2 answers

How to export from NetwokX / OSMnx and back?

I want to be able to export a graph made by OSMnx (in other words, NetworkX graph) into CSV and to call it back later. Couldn't find any good way to do that so I try to export it into Numpy / Pandas and to export that. So I built this little…
Guy
  • 161
  • 1
  • 1
  • 8
0
votes
2 answers

Optimize shortest path calculation in an osmnx network

My question is rather simple. I have to calculate the shortest path between all nodes in an osmnx network. However this takes an enormous amount of time. I was wondering if there was anything that could speed up/optimize the process. Thank you in…
DPM
  • 845
  • 7
  • 33
0
votes
1 answer

Plot on one fig two independent plots with matplotlib, different scale on x and y

I want two independent plots to be overlayed on one matplotlib figure. So I plot a network graph from osmnx import osmnx as ox G = ox.graph_from_place('Piedmont, California, USA', network_type='drive') fig, ax = ox.plot_graph(G) Then I plot the…
0
votes
1 answer

Fastest way to project a graph onto espg:4326 in OSmnx

I have used OSmnx's osmnx.graph_project to first project my graph onto UTM coordinate system in order to use consolidate_intersections function and then ox.project_graph(G_proj_ConsolidateIntersection, to_crs='epsg:4326') to project it onto…
Rob
  • 241
  • 1
  • 14
0
votes
1 answer

Routing millions of paths

I have an OD matrix of some 3 million paths that I would like to route on the OSM network. Using Dijkstra, I get about 20 paths per minute or a total time of 2,500 hours. That would be barely ok if the nearest_node algorithm wouldn't miss a…
Jochen
  • 1
0
votes
1 answer

Dividing streets to smaller segments in OSmnx

Is it possible to divide street segments to smaller parts in OSmnx? For instance let's say we want to divide a street in 10 meter segments or divide a street into 10 equal parts. G = ox.graph_from_place('Piedmont, California, USA',…
Rob
  • 241
  • 1
  • 14
0
votes
1 answer

How to get the length of all the drivable or bikeable roads in OSMnx for a chosen city?

I am trying to get the LENGTH of all the drivable streets in Paris, for example. From the documentation, I found this code to get the area of all roads in square meters. What I want to get is the length of all this drivable roads in meters or…
ctrl_z
  • 268
  • 1
  • 15
0
votes
0 answers

Error: 'localhost refused to connect' when loading background map from osmnx folium in Google Coblab

I am using Google Colab. I am trying to add a background map to a network map via the built-in function ox.plot_graph_folium from osmnx. However, the map is not shown up. My code: graph_map = ox.plot_graph_folium(G, popup_attribute='name',…
0
votes
1 answer

Convert closed Linestrings from OSMnx graph into Multipolygon

I'm retrieving some geometries from OpenStreetMap with OSMnx library with the following code: G = ox.graph_from_place('Casco Viejo, Bilbao, Spain', network_type='walk', retain_all=True, buffer_dist = 50, which_result = 2, …
Rodrigo Vargas
  • 273
  • 3
  • 17
0
votes
1 answer

OSMNX/networkx projection disconnects nodes

I would like to create a map of isolines for a given country. I fetched road map using OSMNX: cf = '["highway"~"motorway|motorway_link|trunk|primary|secondary"]' G = ox.graph_from_place('Venezuela', network_type='drive', custom_filter=cf) # project…
kedar
  • 45
  • 7