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

Add copyright/attribution message to downloaded map images #735

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

Conversation

mmd-osm
Copy link
Contributor

@mmd-osm mmd-osm commented Feb 3, 2025

This PR adds OSM attribution to the map export, both for vector and raster formats. Besides, this PR adds webp image format.

Image

I introduced a new dependency on python3-pil package to enable the png->{webp,jpeg} conversion.

Fixes openstreetmap/openstreetmap-website#551

@mmd-osm
Copy link
Contributor Author

mmd-osm commented Feb 3, 2025

So regarding the temporary file vs. BytesIO topic. I looked at both options and thought it might be safer to store intermediate results on disk, rather than trying to juggle everything in memory. I also noticed the "resource.setrlimit" at the beginning and thought that memory usage is something to watch out for.

Are temporary files too much of a concern?

@tomhughes
Copy link
Member

The memory limit is mostly just a backstop against people doing stupid things, especially with the vector output formats as I recall.

Temporary files generally make me nervous because you need to be sure they will always get cleaned up properly, especially if like here you're not immediately deleting them, which you can't if you need to be able to pass them to functions by name. Though all the functions here could actually take a handle instead I think.

@mmd-osm mmd-osm force-pushed the feature/exportattribution branch from f796226 to 4b15ef9 Compare February 4, 2025 07:13
@pnorman
Copy link
Collaborator

pnorman commented Feb 4, 2025

memory usage is something to watch out for.

I suspect this is because Mapnik can get memory crazy with some output formats. The memory limit is 4GB, so I don't see that storing the rasterized output in-memory is an issue.

PDF and PS are terrible to use with Mapnik and likely to break stuff in other ways, so I wouldn't worry about those.

mmd-osm added a commit to mmd-osm/openstreetmap-website that referenced this pull request Feb 4, 2025
mmd-osm added a commit to mmd-osm/openstreetmap-website that referenced this pull request Feb 4, 2025
mmd-osm added a commit to mmd-osm/openstreetmap-website that referenced this pull request Feb 5, 2025
@mmd-osm mmd-osm force-pushed the feature/exportattribution branch 4 times, most recently from 4b661a5 to d8a3e10 Compare February 19, 2025 17:19
@mmd-osm mmd-osm force-pushed the feature/exportattribution branch from d8a3e10 to 6b867e0 Compare February 19, 2025 17:27
@mmd-osm mmd-osm requested a review from tomhughes February 19, 2025 18:56
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.

Downloaded map images do not have a copyright/attribution message
5 participants