Created
February 21, 2024 11:03
-
-
Save salahelfarissi/e7ac23006008f32913919672f68f2757 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ? wmts | |
if MODE == "WMTS": | |
url = "https://data.geopf.fr/wmts" | |
layer = "LANDCOVER.CLC18_FR" | |
ogcc.METERS_PER_UNIT["EPSG:" + str(PROJ_CRS)] = 1 | |
ogcc._URN_TO_CRS["EPSG:" + str(PROJ_CRS)] = ccrs.GOOGLE_MERCATOR | |
m.ax.add_wmts(url, layer, zorder=0.1) | |
# ? WMTS legend | |
ireland_wms = WebMapTileService("https://data.geopf.fr/wmts") | |
imgurl = list(ireland_wms.contents["LANDCOVER.CLC18_FR"].styles.values())[0].get( | |
"legend" | |
) | |
# the pixel size of the entries (to split the legend into individual rows) | |
entry_width, entry_height = 20, 20 | |
img = requests.get(imgurl) | |
img = img.content | |
img = io.BytesIO(img) | |
img = PngImagePlugin.PngImageFile(img) | |
img.save("./legends/legend.png") | |
m.add_logo( | |
filepath="./legends/legend.png", | |
position="ll", | |
size=0.74, | |
pad=(0.06, 0.08), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment