Compare commits
2 commits
dc5914080c
...
e0eff21265
Author | SHA1 | Date | |
---|---|---|---|
e0eff21265 | |||
fe0910bd39 |
5 changed files with 101 additions and 122 deletions
|
@ -1,5 +1,6 @@
|
||||||
stadiamaps:
|
osm:
|
||||||
api_key:
|
url_template: https://tile.openstreetmap.org/{z}/{x}/{y}.png
|
||||||
|
attribution: © OpenStreetMap
|
||||||
nominatim:
|
nominatim:
|
||||||
api_base_url:
|
api_base_url:
|
||||||
mastodon:
|
mastodon:
|
||||||
|
|
BIN
fonts/Cabin-Regular.ttf
Normal file
BIN
fonts/Cabin-Regular.ttf
Normal file
Binary file not shown.
|
@ -1,115 +1,93 @@
|
||||||
This repository is a fork of Libre Franklin: https://github.com/impallari/Libre-Franklin
|
Copyright 2018 The Cabin Project Authors (https://github.com/impallari/Cabin.git)
|
||||||
|
|
||||||
## License for USWDS’s Modified Version
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
This repository contains both the original font software for Libre Franklin (the “Original Version”) and font software modifications made by the General Services Administration (GSA). This repository combines the Original Version and these GSA modifications into a piece of font software called Public Sans, which is a “Modified Version” of Libre Franklin.
|
https://openfontlicense.org
|
||||||
|
|
||||||
As a work of the United States Government, the font software modifications made by GSA are not subject to copyright within the United States. Additionally, GSA waives copyright and related rights in its font software modifications worldwide through the [CC0 1.0 Universal public domain dedication](https://creativecommons.org/publicdomain/zero/1.0/).
|
|
||||||
|
-----------------------------------------------------------
|
||||||
The Original Version (as defined in the SIL Open Font License, Version 1.1) remains subject to copyright under the SIL Open Font License, Version 1.1.
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
This Modified Version (Public Sans) contains both software under the SIL Open Font License, Version 1.1 and software modifications by GSA released as CC0. As a work of the United States Government, the software modifications made by GSA are not subject to copyright within the United States. Additionally, GSA waives copyright and related rights in its software modifications worldwide through the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/). It is a “joint work” made of the original software and modifications combined into a single work.
|
|
||||||
|
PREAMBLE
|
||||||
**In practice, users of this Modified Version (Public Sans) should use Public Sans according to the terms of the SIL Open Font License, Version 1.1, below.** This is because this font is a combination of work subject to copyright and work not subject to copyright, so the more restrictive requirements apply to using the combined work.
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
## License of project USWDS’s Modified Version is based on
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
- Libre Franklin is licensed under the SIL Open Font License, Version 1.1 (<http://scripts.sil.org/OFL>)
|
with others.
|
||||||
- To view the copyright and specific terms and conditions of Libre Franklin, please refer to [OFL.txt](https://github.com/impallari/Libre-Franklin/blob/master/OFL.txt)
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
## SIL Open Font License, Version 1.1
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
Copyright 2015 The Public Sans Project Authors (https://github.com/uswds/public-sans)
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
This license is copied below, and is also available with a FAQ at http://scripts.sil.org/OFL
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
```
|
DEFINITIONS
|
||||||
-----------------------------------------------------------
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
-----------------------------------------------------------
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
PREAMBLE
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
copyright statement(s).
|
||||||
development of collaborative font projects, to support the font creation
|
|
||||||
efforts of academic and linguistic communities, and to provide a free and
|
"Original Version" refers to the collection of Font Software components as
|
||||||
open framework in which fonts may be shared and improved in partnership
|
distributed by the Copyright Holder(s).
|
||||||
with others.
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
The OFL allows the licensed fonts to be used, studied, modified and
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
redistributed freely as long as they are not sold by themselves. The
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
fonts, including any derivative works, can be bundled, embedded,
|
new environment.
|
||||||
redistributed and/or sold with any software provided that any reserved
|
|
||||||
names are not used by derivative works. The fonts and derivatives,
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
however, cannot be released under any other type of license. The
|
writer or other person who contributed to the Font Software.
|
||||||
requirement for fonts to remain under this license does not apply
|
|
||||||
to any document created using the fonts or their derivatives.
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
DEFINITIONS
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
"Font Software" refers to the set of files released by the Copyright
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
Holder(s) under this license and clearly marked as such. This may
|
Software, subject to the following conditions:
|
||||||
include source files, build scripts and documentation.
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
"Reserved Font Name" refers to any names specified as such after the
|
in Original or Modified Versions, may be sold by itself.
|
||||||
copyright statement(s).
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
"Original Version" refers to the collection of Font Software components as
|
redistributed and/or sold with any software, provided that each copy
|
||||||
distributed by the Copyright Holder(s).
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
in the appropriate machine-readable metadata fields within text or
|
||||||
or substituting -- in part or in whole -- any of the components of the
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
Original Version, by changing formats or by porting the Font Software to a
|
|
||||||
new environment.
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
"Author" refers to any designer, engineer, programmer, technical
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
writer or other person who contributed to the Font Software.
|
presented to the users.
|
||||||
|
|
||||||
PERMISSION & CONDITIONS
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Software shall not be used to promote, endorse or advertise any
|
||||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
redistribute, and sell modified and unmodified copies of the Font
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
Software, subject to the following conditions:
|
permission.
|
||||||
|
|
||||||
1) Neither the Font Software nor any of its individual components,
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
in Original or Modified Versions, may be sold by itself.
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
2) Original or Modified Versions of the Font Software may be bundled,
|
remain under this license does not apply to any document created
|
||||||
redistributed and/or sold with any software, provided that each copy
|
using the Font Software.
|
||||||
contains the above copyright notice and this license. These can be
|
|
||||||
included either as stand-alone text files, human-readable headers or
|
TERMINATION
|
||||||
in the appropriate machine-readable metadata fields within text or
|
This license becomes null and void if any of the above conditions are
|
||||||
binary files as long as those fields can be easily viewed by the user.
|
not met.
|
||||||
|
|
||||||
3) No Modified Version of the Font Software may use the Reserved Font
|
DISCLAIMER
|
||||||
Name(s) unless explicit written permission is granted by the corresponding
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
Copyright Holder. This restriction only applies to the primary font name as
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
presented to the users.
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
Software shall not be used to promote, endorse or advertise any
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
Modified Version, except to acknowledge the contribution(s) of the
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
permission.
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
|
|
||||||
5) The Font Software, modified or unmodified, in part or in whole,
|
|
||||||
must be distributed entirely under this license, and must not be
|
|
||||||
distributed under any other license. The requirement for fonts to
|
|
||||||
remain under this license does not apply to any document created
|
|
||||||
using the Font Software.
|
|
||||||
|
|
||||||
TERMINATION
|
|
||||||
This license becomes null and void if any of the above conditions are
|
|
||||||
not met.
|
|
||||||
|
|
||||||
DISCLAIMER
|
|
||||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
||||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
||||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
||||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
||||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
||||||
```
|
|
Binary file not shown.
10
scl.py
10
scl.py
|
@ -27,7 +27,8 @@ except requests.JSONDecodeError:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
config = yaml.safe_load(open("config.yml"))
|
config = yaml.safe_load(open("config.yml"))
|
||||||
stadiamaps_api_key = config["stadiamaps"]["api_key"]
|
osm_url_template = config["osm"]["url_template"]
|
||||||
|
osm_attribution = config["osm"]["attribution"]
|
||||||
nominatim_url = config["nominatim"]["api_base_url"]
|
nominatim_url = config["nominatim"]["api_base_url"]
|
||||||
mastodon_client = Mastodon(
|
mastodon_client = Mastodon(
|
||||||
client_id=config["mastodon"]["client_id"],
|
client_id=config["mastodon"]["client_id"],
|
||||||
|
@ -39,14 +40,14 @@ mastodon_client = Mastodon(
|
||||||
|
|
||||||
class AttribStaticMap(staticmap.StaticMap, object):
|
class AttribStaticMap(staticmap.StaticMap, object):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.attribution = "© Stadia Maps © OpenMapTiles © OpenStreetMap"
|
self.attribution = osm_attribution
|
||||||
super(AttribStaticMap, self).__init__(*args, **kwargs)
|
super(AttribStaticMap, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def _draw_features(self, image):
|
def _draw_features(self, image):
|
||||||
super(AttribStaticMap, self)._draw_features(image)
|
super(AttribStaticMap, self)._draw_features(image)
|
||||||
|
|
||||||
txt = Image.new("RGBA", image.size, (255, 255, 255, 0))
|
txt = Image.new("RGBA", image.size, (255, 255, 255, 0))
|
||||||
fnt = ImageFont.truetype("fonts/PublicSans-Regular.otf", 24)
|
fnt = ImageFont.truetype("fonts/Cabin-Regular.ttf", 24)
|
||||||
d = ImageDraw.Draw(txt)
|
d = ImageDraw.Draw(txt)
|
||||||
|
|
||||||
textSize = fnt.getbbox(self.attribution)
|
textSize = fnt.getbbox(self.attribution)
|
||||||
|
@ -132,8 +133,7 @@ def do_initial_post(
|
||||||
map = AttribStaticMap(
|
map = AttribStaticMap(
|
||||||
1024,
|
1024,
|
||||||
1024,
|
1024,
|
||||||
url_template="https://tiles.stadiamaps.com/tiles/outdoors/{z}/{x}/{y}@2x.png?api_key="
|
url_template=osm_url_template,
|
||||||
+ stadiamaps_api_key,
|
|
||||||
tile_size=512,
|
tile_size=512,
|
||||||
)
|
)
|
||||||
assert event["polygons"]["type"] == "polygon"
|
assert event["polygons"]["type"] == "polygon"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue