File size: 1,770 Bytes
da43bcd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import leafmap.foliumap as leafmap
# +
from pathlib import Path
files = [path for path in Path('.').glob('**/*.tif')]
done = [path for path in Path('.').glob('cogs/*.tif')]
# -
B = [x.name for x in done]
A = [x.name.lower() for x in files]
C=[i for i in A if i not in B]
C
# +
for x in inputs:
dest = "cogs/" + x.name.lower()
leafmap.image_to_cog(str(x), dest)
# +
m = leafmap.Map(center=[35, -100], zoom=3)
#m.add_basemap("Esri.WorldGrayCanvas")
#m.add_cog_layer("https://data.source.coop/cboettig/mobi/species-richness-all/SpeciesRichness_All.tif", palette="Reds", name="Richness", nodata=0, transparent_bg=True, opacity = 0.9)
m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/irrecoverable_c_total_2018.tif", palette="reds", name="irrecoverable carbon", transparent_bg=True, opacity = 0.8)
m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/vulnerable_c_total_2018.tif", palette="purples", name="vulnerable carbon", transparent_bg=True, opacity = 0.8)
m.add_cog_layer("https://data.source.coop/cboettig/carbon/cogs/manageable_c_total_2018.tif", palette="greens", name="manageable carbon", transparent_bg=True, opacity = 0.8)
m.to_html("map.html")
m
|