We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
OSM images are only allowed to use, if you add a license hint: https://www.openstreetmap.org/copyright/en
Can you please add a function for this?
The text was updated successfully, but these errors were encountered:
I did it like this:
class AttribStaticMap(StaticMap, object): def __init__(self, *args, **kwargs): self.attribution = u'© OpenStreetMap-Mitwirkende' super(AttribStaticMap, self).__init__(*args, **kwargs) def _draw_features(self, image): super(AttribStaticMap, self)._draw_features(image) txt = Image.new('RGBA', image.size, (255, 255, 255, 0)) # get a font fnt = ImageFont.truetype('FreeMono.ttf', 12) # fnt = ImageFont.load_default() # get a drawing context d = ImageDraw.Draw(txt) textSize = fnt.getsize(self.attribution) textPosition = (image.size[0] - textSize[0], image.size[1] - textSize[1]) offset = 2 options = {'fill': (255, 255, 255, 180)} d.rectangle([(textPosition[0] - (2 * offset), textPosition[1] - (2 * offset)), (textSize[0] + textPosition[0] + (2 * offset), textSize[1] + textPosition[1] + (2 * offset))], **options) # draw text, full opacity d.text((textPosition[0] - offset, textPosition[1] - offset), self.attribution, font=fnt, fill='black') image.paste(txt, (0, 0), txt)
Sorry, something went wrong.
No branches or pull requests
OSM images are only allowed to use, if you add a license hint:
https://www.openstreetmap.org/copyright/en
Can you please add a function for this?
The text was updated successfully, but these errors were encountered: