This PR introduces a new parameter ratio to allow drawing rectangular maps.
figsize = tuple(35.1, 49.6)
fig, ax = plt.subplots(figsize=figsize)
plot(
"Paris",
ax=ax,
radius=1000,
ratio=figsize[0]/figsize[1],
credit=False,
layers=layers, # defined elsewhere
style=style, # defined elsewhere
preset=None, # needed to avoid overriding the default preset into the provided style and layers
)
The ratio part is pretty straightforward, it just updates the perimeter boundary creation to use the introduced ratio parameter.
However, some other parts of the code were written under the assumption that the ratio is 1, these parts needed to be updated as well. The background generation now uses pad and dilate:
pad scales the perimeter boundary of a certain amount to generate the background.
dilate add a certain amount to the perimeter boundary to generate the background.
In case of a ratio different of 1, using only pad, the margin added to the background are not homogeneous between vertical and horizontal sides. Whereas dilate adds the same amount of margin on all sides.
The default value for pad is set at 1 in the code, but at 1.1 in the presets, to keep the existing behavior.
This PR also reintroduces the dilate parameter in the layers to allow printing some layers outside of others. In the example above, streets and water layers have a dilate value of 100.
This PR introduces a new parameter
ratio
to allow drawing rectangular maps.The ratio part is pretty straightforward, it just updates the perimeter boundary creation to use the introduced
ratio
parameter.However, some other parts of the code were written under the assumption that the ratio is 1, these parts needed to be updated as well. The background generation now uses
pad
anddilate
:pad
scales the perimeter boundary of a certain amount to generate the background.dilate
add a certain amount to the perimeter boundary to generate the background.In case of a ratio different of 1, using only
pad
, the margin added to the background are not homogeneous between vertical and horizontal sides. Whereasdilate
adds the same amount of margin on all sides. The default value forpad
is set at 1 in the code, but at 1.1 in the presets, to keep the existing behavior.This PR also reintroduces the
dilate
parameter in the layers to allow printing some layers outside of others. In the example above, streets and water layers have adilate
value of 100.