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