Skip to main content
5 votes
Accepted

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

I had a similar problem, I wanted to access the surface of streets. Answer The setting of the attributes that are transferred to the graph are defined in the settings.py useful_tags_path = ['bridge'...
Fabian's user avatar
  • 66
4 votes
Accepted

Syntax for retrieving the coordinates of point features using GeoPandas

It depends on the format of the coordinates you want import geopandas as gpd df = gpd.read_file("points.shp") df.head(3) FID geometry 0 0 POINT (-0.18411 0.47266) 1 1 POINT (...
gene's user avatar
  • 55.2k
3 votes
Accepted

Creating a geodataframe from a list of LineStrings or routes

Try changing your code as seen below: Gamle_routes_geom = gpd.GeoDataFrame({'geometry':[Gamle_route_Grünerløkka_line, Gamle_route_Sagene_line, ...
Felipe D.'s user avatar
  • 2,729
3 votes

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

Whenever I get "ValueError: Invalid field type <class 'list'>". it is when I am trying to convert a geodataframe which has a string/object field with lists in it to shapefile. Do you ...
Bera's user avatar
  • 76.4k
3 votes
Accepted

Query to Calculating Rail Length Using Overpass API / OSMnx Python

Whatever the number of tracks, it's the total length of all of them that will be given. You don't need to divide anything by any what. If there are missing data, it's an other problem. So basically, ...
swiss_knight's user avatar
  • 10.7k
2 votes
Accepted

Convert Linestrings from OSMnx into Multipolygon

For that you need to use unary_union and polygonize (see Split polygon by MultiLineString - shapely) .... ped = ox.graph_to_gdfs(G, nodes = False) from shapely.ops import unary_union, polygonize ...
gene's user avatar
  • 55.2k
2 votes
Accepted

Parallel offset on Folium

Finally, I have resolved the problem points = [] for u,v,data in G.edges(keys=False, data=True): if 'geometry' in data: xs,ys = data['geometry'].xy point = list(zip(xs,ys)) ...
aba2s's user avatar
  • 191
2 votes
Accepted

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

According to the documentation of OSMNX, your line with G = ox.add_edge_speeds(G) will : Add edge speeds (km per hour) to graph as new speed_kph edge attributes. By default, this imputes free-flow ...
XaC's user avatar
  • 407
2 votes

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

tl;dr import geopandas as gpd gdf = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) description A dataframe with all the 195 countries geometries can be found without using osmnx, thanks ...
SeF's user avatar
  • 121
1 vote

City Suburbs Polygon using OSMNX

Got it! The edits worked. Changed and added tags in Open Street Maps: type: multipolygon, area: yes, boundary: administrative. With those edits the query managed to succeed. I had to wait a while for ...
Irving Bennett's user avatar
1 vote

Extracting relations with osmnx?

Right at the beginning of the osmnx.geometries module definition "You can use this module to query for nodes, ways, and relations (the latter of type “multipolygon” or “boundary” only)" That ...
Scipio's user avatar
  • 141
1 vote

Convert a list of coordinates to an OSM path using Python

The path must be a list of route lists itineraire = [(-7.5822778, 33.5649577), (-7.5823494, 33.5651468), (-7.582575300000001, 33.5656444), (-7.582148500000001, 33.565812), (-7.5819043, 33.5658939), (-...
gene's user avatar
  • 55.2k
1 vote
Accepted

Point projection in GeoPandas for OSMnx graph

I still can't tell what is wrong with the code above, however I did manage to find a way to convert the point correctly now (which in addition works without GeoPandas) import osmnx as ox from shapely....
eagle's user avatar
  • 31
1 vote

Seeing which node has given node ID in osmnx

If you know the locations you want to route from and to, you can use the built-in method nearest_nodes: import osmnx as ox place = "Piedmont, California, USA" G = ox.graph_from_place(place, ...
Christian's user avatar
  • 131
1 vote
Accepted

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

I wasn't able to download buildings data from OSM with a polygon (shapefile) as the bounding box however I was able to using distance from a point with the following code: import osmnx as ox import ...
hbk's user avatar
  • 434
1 vote

OSMNX - City Suburbs Polygons

From what I understand, this node is what you are currently getting, but this relation is what you actually want. On OSM, the San Salvario place:suburb is represented as a node but its boundary is ...
gboeing's user avatar
  • 201
1 vote
Accepted

Showing two roads lane of one road

Your function suffers some tiny bugs, let's fix them one by one and explore the code. # imports import numpy as np import geopandas as gpd import folium import osmnx as ox ox.config(use_cache=True, ...
swiss_knight's user avatar
  • 10.7k
1 vote
Accepted

osmnx.get_nearest_edge(s) behaves randomly

The two problems are: Must send (y, x) coordinates to the get_nearest_edge() method. Must project the graph. import osmnx G = osmnx.graph_from_place("Berlin, Germany", network_type="...
Gabriel De Luca's user avatar
1 vote
Accepted

How to save overpy query to .osm?

You don't really need the overpy package to retrieve raw OSM from overpass API. You can do direct http calls like in the following, using requests library. We also provide the solution to both write ...
ThomasG77's user avatar
  • 31.1k
1 vote
Accepted

Writing osmnx queried footprints to shapefile

Open StreetMap building footprints include a 'nodes' column that is of datatype list. I ended up using this code to drop the column and afterwards the shapefile was written correctly fprints.drop(['...
jport's user avatar
  • 437

Only top scored, non community-wiki answers of a minimum length are eligible