Plot Open Street Map Data#
This was originally posted to pyvista/pyvista-support#486.
Be sure to check out osmnx
Start by generating a graph from an address.
import numpy as np import osmnx as ox import pyvista as pv # Alternatively, use the pickeled graph included in our examples. from pyvista import examples
Read in the graph directly from the Open Street Map server.
# address = 'Holzgerlingen DE' # graph = ox.graph_from_address(address, dist=500, network_type='drive') # pickle.dump(graph, open('/tmp/tmp.p', 'wb')) graph = examples.download_osmnx_graph()
Next, convert the edges into pyvista lines using
Finally, merge the lines and plot
Total running time of the script: ( 0 minutes 0.593 seconds)