[OSM-dev] Auto adding attribution to image creation.

Tom Hughes tom at compton.nu
Tue Aug 6 12:47:51 UTC 2019


On 06/08/2019 13:29, Dave F via dev wrote:
> 
> 
> On 06/08/2019 12:26, Tom Hughes wrote:
>> On 06/08/2019 12:04, Dave F via dev wrote:
>>
>>> A user has asked why the image creation tool under 'Share' couldn't 
>>> automatically add an attribution. It would certainly save me a lot of 
>>> email sending asking users to add it.
>>
>> If you mean the option 
> 
> I'm surprised your confused. I thought I was perfectly clear.

The "share" tool offers a number of options and I just wanted
to be clear which one we were talking about.

>> that gives you an image based on the
>> default rendering then the answer is that all that option does
>> is to to a custom render using mapnik, and that render has
>> no way to add an attribution.
>>
>>> Would it be much coding effort?
>>
>> Yes.
>>
>> I mean you can certainly do it, but it means writing a whole
>> bunch of code to work out what font size to use then render
>> some text and overlay it on the mapnik generated image.
> 
> There must be calculations performed to create the clipped image
>   especially considering the Scale: option provided.
> Inserting an image of the attribution into the corner of the map image 
> at a defined percentage of its size can't add that much additional 
> overheads,
> 
> There are plenty of 'image stamper' programs on the market which do 
> similar.

The script is here:

https://github.com/openstreetmap/chef/blob/master/cookbooks/tile/templates/default/export.erb

Patches are welcome.

Make sure they work for all the output formats ;-)

Tom

-- 
Tom Hughes (tom at compton.nu)
http://compton.nu/



More information about the dev mailing list