2

I have a dataframe composed of different trips, categorised by the type of trip (e.g. by car or by bike). Each line of the dataframe represents a stop of a given trip, including the sequence of the stop in the trip as well as its latitude/longitude coordinates.

After some search on how to plot those trips, i discovered the osmnx package. The streets network is awesome but takes a long time to be generated, especially for large zones.

Is there a way to increase computation performance, for instance downloading in local the network of the region or any other way?

Thank you for your help

import osmnx as ox
import matplotlib.pyplot as plt

place_name='France'
graph=ox.graph_from_place(place_name)  
type(graph)

nodes, edges = ox.graph_to_gdfs(graph)   
nodes.head()
edges.head()
type(edges)

fig, ax = plt.subplots(figsize=(15,15)) 
edges.plot(ax=ax, linewidth=1, edgecolor='#BC8F8F')
  • You'll need to provide a complete minimal reproducible code snippet demonstrating your current method for us to be able to assess its specific efficiency or suggest improvements. – gboeing Nov 12 '20 at 15:40
  • I updated the question with the current used method. If i change 'Switzerland' to 'Toulouse, France' for example, i do not have any issue to get the network. I thus tried to get the same network for full France – CharlesAntoine Nov 12 '20 at 23:16

1 Answers1

2

If you want to download a network for an entire country like Switzerland or France, you will need an enormous amount of RAM to store it in memory. You may want to filter to retain only certain road types. See also https://stackoverflow.com/a/52412274/7321942

In addition, you should turn caching on with ox.config(use_cache=True, log_console=True). See the documentation for details. You should also turn logging on to see what's happening under the hood if you're wondering why it's taking so long.

gboeing
  • 5,691
  • 2
  • 15
  • 41
  • Thank you for the time you took to answer and share the similar question link. I will dig into the route types and suggested parameters – CharlesAntoine Nov 18 '20 at 21:38