openstreetmap / openstreetmap-website

The Rails application that powers OpenStreetMap
https://www.openstreetmap.org/
GNU General Public License v2.0
2.18k stars 914 forks source link

Downloaded map images do not have a copyright/attribution message #551

Open simonpoole opened 10 years ago

simonpoole commented 10 years ago

Map images that are downloaded via "Share" - "Download" do not have a copyright message. This is mainly an issue when the download gets printed without further processing (assuming that somebody that imbeds an image in a website should be capable of adding correct attribtution).

Best solution is likely to have this as a user selectable option.

tomhughes commented 10 years ago

Well until somebody invents a way of doing it everything else is irrelevant...

ghost commented 10 years ago

Wanted to suggest the same.

I've got an idea, which could solve this and eliminates the too busy messages.

Why not installing staticMapLite? Here a quick example: https://wiki.openstreetmap.org/wiki/File:Share-staticmaplite-example.png

It's fast and doesn't need to rerender the desired map part, because it uses the prerendered tiles and glues them together.

With low modification optional localized attribution is available. And additionally these map images can be created in every listed map style.

A direct disk access to the map tiles can improve the io performance (not yet implemented).

mmd-osm commented 4 years ago

Looking at it from a technical point of view, is this the script that needs to be adjusted? https://github.com/openstreetmap/chef/blob/master/cookbooks/tile/templates/default/export.erb

tomhughes commented 4 years ago

Yes.

mmd-osm commented 4 years ago

Thanks! One thing we could try is to reach out to @hholzgra. Hartmut has given numerous talks at conferences on mapnik, python and printing maps and is probably the expert on the topic. Maybe he has some good ideas on how to best add osm attribution to this script.

hholzgra commented 4 years ago

MapOSMatic solves this (and other things) by not having Mapnik itself creating the final output file, but by having it render into a Cairo Graphics surface instead, and then using pyCairo to add attribution, a title bar, etc. ...

hholzgra commented 4 years ago

Looking at export.erg, it essentially seems to be doing the same -- render into a cairo surface -- so adding extra text to the generated map, either as an overlay, or by adding a bit of border to have text on white, shouldn't be much of an issue?

tomhughes commented 4 years ago

Currently it only uses a cairo surface for vector formats - for bitmaps it renders direct.

mmd-osm commented 4 years ago

@hholzgra : thanks a lot for the quick reply and your time to look into this. I poked a bit in the MapOSMatic org and found the following two snippets to add some copyright notice to the map. Would that be the right place to look at?

https://github.com/maposmatic/ocitysmap/blob/master/ocitysmap/layoutlib/single_page_renderers.py#L275-L322 https://github.com/maposmatic/ocitysmap/blob/master/ocitysmap/layoutlib/single_page_renderers.py#L431-L447

hholzgra commented 4 years ago

@mmd-osm The code in the original maposmatic repository has not been maintained in quite a while, the acual copyright notice generation has become more complicated in my fork as it now also adds copyright information for the base style and all optional overlay styles to the text. What's also not shown in that part of the code is how the extra white space around the map area is added before rendering the map and the annotation text. But yes, those snippets above show the general idea.

The actual annotation message construction now looks like this:

https://github.com/hholzgra/ocitysmap/blob/master/ocitysmap/layoutlib/single_page_renderers.py#L371

But as far as I remember the export on osm.org only supports the CartoOSM style anyway, not the other three styles, and there are no optional overlays there anyway, so the mostly static text from the original maposmatic code should already do.

It would just need to be changed to mention the ODBL instead of CC-By-SA for the map data itself, the text in the original maposmatic branch is still from before the big license change ...

hholzgra commented 4 years ago

@tomhughes I personally would only add the text to the vector format documents, and just leave the bitmap output as is, assuming that it is only used for embedding static map images in websites where attribution can be taken care of outside of the image, as mentioned in the initial comment here.

Direct PNG rendering via Mapnik also has the advantage that it can use the AGG rendering backend instead of Cairo Graphics, which produces slightly better bitmap results. With all the extra decorations added by MapOSMatic, we have no choice but to render into a cairo surface for all formats there, but for just adding an annotation text rendering a PNG with Mapnik directly, and then using some other image library like e.g. PIL to overlay the annotation text over the generated image ...?