I am working in Jupyter and don't understand why OsmNx saves SVG and PNG with different scales.
I tried changing DPI and tweaked other parameters, but didn't solve the issue.
I found nothing about it in the online documentation and some tutorials.
This is a stripped-down working code:
import osmnx as ox
import os
from IPython.display import Image
%matplotlib inline
ox.config(log_file=False, log_console=False, use_cache=True)
place = "aPlace"
network_type = "drive"
location_point = (50.6233696,12.3007474)
G = ox.graph_from_point(
location_point,
distance=1600, #<============
distance_type='bbox',
network_type="drive",
clean_periphery=False,
)
street_widths = {'footway' : 0.5,
'steps' : 0.5,
'pedestrian' : 0.5,
'path' : 0.5,
'track' : 0.5,
'service' : 2,
'residential' : 3,
'primary' : 5,
'motorway' : 6}
ox.plot_graph(G, show=True,node_size=0, edge_linewidth=2, edge_color="#000000", save=True, filename="map1", file_format='svg')
ox.plot_figure_ground(G, street_widths=street_widths, show=True, bgcolor="#ffff00", edge_color="#000000", save=True, filename="map1", file_format="png")
Changing distance
SVG scales properly.
PNG, instead, reaches a maximum size and then it is cropped.
In my project PNG is later vectorialized. I want to keep different road thicknesses according to the road type.
That's why I use plot_figure_ground
(that can accept the parameter street_widths
), and not plot_graph
(that renders all roads with the same thickness).
In this images you can see this effect (SVG white background, PNG yellow background):
What am I doing wrong?