95 create cog
Uncomment the following line to install geemap if needed.
In [ ]:
Copied!
# !pip install geemap
# !pip install geemap
In [ ]:
Copied!
import geemap
import geemap
If you are using a recently implemented geemap feature that has not yet been released to PyPI or conda-forge, you can uncomment the following line to install the development version from GitHub.
In [ ]:
Copied!
# geemap.update_package()
# geemap.update_package()
Provide a dataset path or URL.
In [ ]:
Copied!
url = "https://github.com/giswqs/data/raw/main/raster/srtm90.tif"
url = "https://github.com/giswqs/data/raw/main/raster/srtm90.tif"
Validate COG.
In [ ]:
Copied!
geemap.cog_validate(url)
geemap.cog_validate(url)
In [ ]:
Copied!
geemap.cog_validate(url, verbose=True)
geemap.cog_validate(url, verbose=True)
Convert the image to tiled COG.
In [ ]:
Copied!
out_cog = "cog.tif"
geemap.image_to_cog(url, out_cog)
out_cog = "cog.tif"
geemap.image_to_cog(url, out_cog)
Validate COG.
In [ ]:
Copied!
geemap.cog_validate(out_cog)
geemap.cog_validate(out_cog)
In [ ]:
Copied!
geemap.cog_validate(out_cog, verbose=True)
geemap.cog_validate(out_cog, verbose=True)
Add COG to map.
In [ ]:
Copied!
m = geemap.Map()
m.add_local_tile(out_cog, palette="dem", layer_name="Local COG")
m.add_cog_layer(url, palette="gist_earth", name="Remote COG")
m
m = geemap.Map()
m.add_local_tile(out_cog, palette="dem", layer_name="Local COG")
m.add_cog_layer(url, palette="gist_earth", name="Remote COG")
m