I have to get street density for a large number (around 5 millions) quadkey 14 tiles from osmnx. To my understanding, this could be done through downloading the graph for a given area, and then take the street_density_km variable from the basic_stats() function on the projected graph; but due to the number of areas I would need to iteratively request data for would make the task unpheasible.
My idea was to download data for a larger area (quadkey 9 tiles for example) this is the streets graph for a tile 13and then take for every child tile in the area a subgraph of nodes intersecting only the smaller tile14 areathis is a child tile 14 of the other area. I would like to be able to extract this exact graph I downloaded through the graph_from_bbox() function by taking the subgraph of the parent tile’s graph, where I would then apply the basic_stats() function.
I have very few experience working with graphs though, and I’m not sure on how to do that, and if that would actually allow for a pheasible task.
I am also unsure on how to navigate multiple requests to osmnx.
I have tried to get street data from a different approach (download the graph for a bigger area, turn the edges into a geodataframe, take for each smaller area a subset of intersecting edges, calculate street density as sum of lengths in the subset divided by area), but it yields significantly different results from the basic_stats() function so I’m not really sure I can trust it. Also, the geodataframe (obtained via the graph_to_gdf() function on the downloaded graph) has a ‘length’ column, but the sum of the lenghts columns is different from the sum of lengths of geometries (in mercator crs), so I would prefer doing it through the ‘official’ basic_stats() method.
Luca Ceribelli is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.