Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rectangular maps #105

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

etnbrd
Copy link

@etnbrd etnbrd commented Jan 12, 2023

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
)

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant