As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [osmnx]

a Python package that lets you download geospatial data from OpenStreetMap.

Filter by
Sorted by
Tagged with
0 votes
0 answers
35 views

Routing from somewhere along an edge in osmnx

I have an osmnx network in Python that has long edges, and points along those edges that I'd like to route to and from. Routing based on the nearest node is a non-starter because the edges are long. ...
jesnes's user avatar
  • 415
1 vote
1 answer
80 views

Osmnx.plot_graph_folium() not working; folium is not recognized

I'm trying to display a osmnx map like: graph_map = ox.plot_graph_folium(coordinates, popup_attribute ="name", edge_width=2) but I get an error: Cell In[40], line 1 ----> 1 graph_map = ...
simonericmoon's user avatar
0 votes
0 answers
24 views

Using a OSM-formatted XML file in osmnx

I want to use function osmnx.geometries.geometries_from_xml to upload the data of an entire country. Now where do i get that osm-formatted xml file? I went to geofabrik and all the commonly used ...
Scipio's user avatar
  • 131
2 votes
1 answer
106 views

Extracting relations with osmnx?

I am using osmnx package https://osmnx.readthedocs.io/en/stable/osmnx.html to extract data from OSM. I aim to obtain relations from the cyclist node network in Flanders. After some info about tagging, ...
ajchavez94's user avatar
0 votes
0 answers
59 views

OSMnx map-matching

I have acquired lines (representing routes) similar to I would like to snap it on OpenStreetMap street network. What is the best way to do so ?
Mohammad's user avatar
0 votes
0 answers
17 views

Sorting out OSMNX road classes

I have been working with OSMNX in the past recent days, and I've come across an issue, whose solution I cant seem to find. Is there a way to sort this out so as to resolve the roads with more than ...
Martin Muriithi's user avatar
1 vote
1 answer
97 views

Issues with graph generated by momepy from GeoPandas Data Frame

I'm trying to create a graph from a GeoPandas Data Frame, but am having an issue where some roads are being excluded, and others are not joined up correctly. As well as that, I'm getting these large ...
George Willcox's user avatar
0 votes
0 answers
38 views

Convert one column in CSV to two separate files: a shapefile and an OSM file in Python

I have a CSV file that contains taxi trips, and one column is called trip_coordinates stored as strings, for example one trip coordinates would look like this (stored as string!): [[40.7457407, -73....
abs8090's user avatar
0 votes
0 answers
246 views

Why OSMnX shortest_path() for a list of origins and destinations is very very slow?

I want to create a list of 1000 random points in Quebec City and then, create a GeoDataFrame (gdf) from all these points. Then, cross join this gdf with itself (1 million rows) to have origins and ...
milad's user avatar
  • 649
0 votes
2 answers
592 views

How to calculate the length and duration of trip for a GeoDataFrame of points on OpenStreetMap using OSMnX package?

I have a GeoDataFrame of GPS points and I want to calculate the length and duration of trip from each point to all other points. My input GeoDataFrame looks like this: id Longitude Latitude ...
milad's user avatar
  • 649
0 votes
0 answers
18 views

osmnx project_gdf producing discontinuities

When using osmnx.project_gdf (osmnx=1.2.1) I have found examples (every 6 degrees) where there are large discontinuities when comparing two points either side of a change in the whole number longitude ...
ushham's user avatar
  • 103
0 votes
0 answers
130 views

Is it possible to obtain a route from origin to destination with intermediate points using OSMNX?

I've an origin co-ordinate (latitude, longitude), destination co-ordinates and a set of intermediate co-ordinates. I wish to find a route from the origin to the destination such that it covers the set ...
RB10's user avatar
  • 1
0 votes
0 answers
156 views

OSMNX to get distance matrix

I'm trying to get distance matrix between multiple OSM points using OSMNX (usign networkx shortest paths). My challenge is to cover an area that assure those multiple points connectivity. I have tried:...
Kareem Althwaini's user avatar
0 votes
1 answer
544 views

Create a GeoDataFrame with all the countries in the world with osmnx, efficiently

I'm trying to create a GeoDataFrame with the names and geometries of all 195 countries in the world. My attempt was to create a rectangle covering the entire world, and then query it with osmnx. ...
SeF's user avatar
  • 111
0 votes
0 answers
161 views

Exporting OSM data as PBF with Python

I managed to download OSM data as a graph and exported as XML file using OSMNX lib with polygon boundary net = ox.graph_from_polygon(zone_polygon, network_type='drive_service', simplify=True) ox....
BAco's user avatar
  • 1
2 votes
0 answers
704 views

Color osmnx map by place (using graph_from_place() method)

Let's say we want to graph the two below villages, which are in the UK. We also want to colour the streets by length. We can do: # Get data import osmnx as ox place = ["Broughton Hackett", &...
johnjohn's user avatar
  • 121
2 votes
1 answer
3k views

Convert a list of coordinates to an OSM path using Python

I have GPS coordinates recorded from vehicles for an itinerary and I need the get the path on osm so I can extract features like highways. I tried to use ox.get_nearest_node method for each point in ...
Ziad Fellah-Idrissi's user avatar
2 votes
1 answer
930 views

Point projection in GeoPandas for OSMnx graph

I am struggling with a crs conversion in GeoPandas. Basically I just want to calculate the distance between a point and an edge of my OSMnx graph. The coordinates of the point are retrieved from the ...
eagle's user avatar
  • 31
2 votes
1 answer
2k views

Creating a geodataframe from a list of LineStrings or routes

I have created a separate LineString for each origin-destination couples of subdivisions and I did it manually cause when I use a for loop it creates a dataframe with 1 LineString from all lines... ...
Kareem Alaraby's user avatar
1 vote
0 answers
180 views

Using Rasterio to create mask from osmnx graph edges creates black .tif

I am using rasterio to create a mask of some .tif with an edge graph that I created with osmnx. I'm assuming that there is something I have to do to the graph to make it work correctly as it works ...
Oliver's user avatar
  • 195
0 votes
0 answers
731 views

Adding a new point to a graph in NetworkX

I am working with some points between which I need to find the shortest paths along a graph in NetworkX. I'm trying to take a point that is currently not on the graph and connect it to the graph, i.e.,...
Borillar0821's user avatar
1 vote
0 answers
581 views

Folium map not updating when adding Tooltip attribute in PyQt GUI

I am trying to create a geospatial Python GUI app using PyQT5, Geopandas, OSMnX, and Folium. I am converting the app into an .EXE file using pyinstaller. The app looks something like this: I am using ...
Magnum Python 93''s user avatar
1 vote
0 answers
657 views

Pyinstaller .EXE AttributeError: partially initialized module 'fiona' has no attribute '_loading' (most likely due to a circular import)

I am trying to create a geospatial Python GUI app using PyQT5, Geopandas, OSMnX, and Folium. I am converting the app into an .EXE file using pyinstaller. Previously, I was successfully able to create ...
Magnum Python 93''s user avatar
1 vote
1 answer
1k views

How to make necessary changes to Geodataframe to export as geopackage or shapefile

I am trying to export a geodatabase I created via the OMSNX package. () When I attempt to convert the file from a geodatabase to shapefile I get an error "ValueError: Invalid field type <class ...
cadejs's user avatar
  • 51
0 votes
0 answers
528 views

Shortest-path algorithms used in Networkx: what about points not near nodes?

I am new to Networkx, but am I right that Dijkstra's is the algorithm Networkx uses by default? From what I understand, Dijkstra's algorithm traces a shortest path between two nodes on a graph. What, ...
Borillar0821's user avatar
0 votes
1 answer
2k views

Syntax for retrieving the coordinates of point features using GeoPandas

I have two point shapefiles (with just one point each, let's call them 'Origin' and 'Destination'). I need to find the shortest path between them over a street network extracted using OSMnx from ...
Borillar0821's user avatar
0 votes
1 answer
951 views

Seeing which node has given node ID in osmnx [closed]

I have been reading the documentation on OSMnx and I am trying to use the command osmnx.shortest_path(G, orig, dest, weight = "length") on a graph of a city. I know which nodes I want to ...
Lucas Silva's user avatar
1 vote
0 answers
106 views

Issue with creating sub graphs from Los Angeles County graph

I am trying to extract a subgraph using networkx ego_graph function from Los Angeles County graph. When i plot this graph and compare it with graph generated from graph_from_point (which looks correct)...
Rahul Agnihotri's user avatar
1 vote
0 answers
230 views

Loading intersections consolidated graphs

To get the right connected components, I projected a graph then use osmnx.simplification.consolidate_intersections to consolidate intersections. import osmnx as ox import pandas as pd import networkx ...
Peter Fu2's user avatar
2 votes
1 answer
455 views

Parallel offset on Folium

Is there any way to add parallel offset for those lines which oneway road are False? All line here are straight (segment). So We just have two points for each line (start and end points). # There is ...
aba2s's user avatar
  • 191
1 vote
1 answer
1k views

Downloading buildings data from OSM with a polygon (shapefile) as the bounding box

I am struggling to complete this task. I am trying OSMnx which can be used to download data from OSM above however I am getting an error when using its from_polygon feature when trying to download ...
hbk's user avatar
  • 434
0 votes
1 answer
1k views

OSMNX - City Suburbs Polygons

I'd like to extract, given a city name, all suburbs and relative polygon geometries. For instance: https://nominatim.articque.com/details.php?place_id=230259366 So, I run the code: place = 'Torino, ...
GiuseppeBrenk's user avatar
2 votes
1 answer
420 views

Showing two roads lane of one road

I am using osmnx package to visualize a street network. I would like to visualize both (two) lanes in opposite directions of a road. I am using this code https://github.com/gboeing/osmnx/issues/162 ...
aba2s's user avatar
  • 191
3 votes
1 answer
2k views

osmnx.get_nearest_edge(s) behaves randomly

I'm struggling with a rather odd problem with the python package OSMNx. I have lots of GPS points in a pandas dataframe that were originally in EPSG 4326, but I've already projected them onto EPSG ...
Ben's user avatar
  • 193
2 votes
1 answer
692 views

Convert Linestrings from OSMnx 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', ...
Rodrigo Vargas's user avatar
0 votes
1 answer
756 views

Is there a way to see the type of tags/features pulled in an OSMnx multigraph?

I'm new to OSMnx / Overpass queries. I'm trying to pull data on rail networks in global cities. I'm using the script in Python below to pull rail data in London, for example. There are a number of ...
Daniel Thomas's user avatar
2 votes
1 answer
806 views

Query to Calculating Rail Length Using Overpass API / OSMnx Python

I'm new to overpass queries. I'm trying to write a python script to pull data on the length of rail in major global cities. I am having a problem in the length of track (using osmnx.basic_stats(G)) ...
Daniel Thomas's user avatar
3 votes
1 answer
2k views

Cannot get OSM tags when downloading data with osmnx functions which are based on Nominatim requests

Context I am trying to download some footway graph from OpenStreetMap (OSM) using osmnx. Here is a piece of code: import os, sys import pandas as pd import geopandas as gpd import matplotlib.cm as cm ...
swiss_knight's user avatar
  • 9,363
0 votes
0 answers
109 views

How to retrieve oneway taxiways from Overpas API?

I have was able to make a query to http://overpass-turbo.eu/ where I request the taxiways of a specific airport like this: [out:xml]/*fixed by auto repair*/[timeout:25]; // fetch area “airport” to ...
Federico Gentile's user avatar
2 votes
1 answer
591 views

How to save overpy query to .osm?

I am using overpy to collect data information about taxiways, taxilanes and parking positions of an airport (icao code LOWW). I was able to achieve my goal I wrote the following lines of code: import ...
Federico Gentile's user avatar
3 votes
0 answers
429 views

Polygon projection fail with osmnx [closed]

I download a graph and plotted an accessability polygon on the projected graph according to tutorial G = ox.project_graph(G) # Then I wanted to project my accessibilty polygon g1 back to 'epsg:3857'...
James Flash's user avatar
1 vote
0 answers
484 views

OSMNx Extracting blocks from point and save coordinates of corners of each block

I am playing with OSMNx and I would like to extract street blocks, I have this code which should display the blocks import osmnx as ox import geopandas as gpd import shapely from shapely.geometry ...
Mechatrnk's user avatar
2 votes
0 answers
169 views

OSMNX KeyError when trying to compute edge_centrality on a graph composition

Context: I am trying to merge several different graphs (some sharing nodes with others) downloaded from openstreetmap using omsmx. While storing these different graphs in a list, I use the nx....
swiss_knight's user avatar
  • 9,363
2 votes
1 answer
795 views

Writing osmnx queried footprints to shapefile

I'm attempting to pull a set of building footprints from open street map using a shapefile boundary. I have success getting the buildings into a geodataframe, but when I attempt to write them out to ...
jport's user avatar
  • 437
2 votes
0 answers
332 views

Street traffic flow (from Azure Map GeoJSON) to OpenStreetMap street network (graph)

The Ultimate Goal: I am trying to find the shortest and least traffic path between two points for a given pair of latitudes and longitudes on the map. This is rather standard in most of the maps, but ...
TwinPenguins's user avatar
2 votes
0 answers
342 views

Save polygon on map

It is probably a noob question but I'm still a beginner with maps and these libraries. I used OSMnx, NetworkX and GeoPandas the draw a map with two polygons on it. Each polygon have the begin with ...
Roy Ancri's user avatar
1 vote
0 answers
2k views

Getting pedestrian network with osmnx

Context I would like to extract into a network (i.e. a graph with a topology that can be used for routing), all pathways that can be 'legally' walked by pedestrians in an geographical area. I am ...
swiss_knight's user avatar
  • 9,363