Skip to content

Instantly share code, notes, and snippets.

@giswqs
Created November 18, 2025 15:02
Show Gist options
  • Select an option

  • Save giswqs/1481b7efd9528e90ef9d4206653067af to your computer and use it in GitHub Desktop.

Select an option

Save giswqs/1481b7efd9528e90ef9d4206653067af to your computer and use it in GitHub Desktop.
AlphaEarth COG
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "fd026445",
"metadata": {},
"source": [
"# Rendering AlphaEarth data as a COG\n",
"\n",
"Data source: https://source.coop/tge-labs/aef/v1/annual/2018/10N/x02qcrn30k70b9ql6-0000000000-0000000000.vrt"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5d94d70d",
"metadata": {},
"outputs": [],
"source": [
"import httpx\n",
"from folium import Map, TileLayer\n",
"\n",
"titiler_endpoint = (\n",
" \"https://titiler.xyz\" \n",
")\n",
"url = \"https://data.source.coop/tge-labs/aef/v1/annual/2018/10N/x02qcrn30k70b9ql6-0000000000-0000000000.vrt\"\n",
"\n",
"r = httpx.get(\n",
" f\"{titiler_endpoint}/cog/info.geojson\",\n",
" params={\n",
" \"url\": url,\n",
" },\n",
").json()\n",
"\n",
"bounds = r[\"bbox\"]\n",
"\n",
"r = httpx.get(\n",
" f\"{titiler_endpoint}/cog/WebMercatorQuad/tilejson.json\",\n",
" params={\n",
" \"url\": url,\n",
" },\n",
").json()\n",
"\n",
"lat = (bounds[1] + bounds[3]) / 2\n",
"lng = (bounds[0] + bounds[2]) / 2\n",
"\n",
"m = Map(\n",
" location=(lat, lng), zoom_start=8\n",
")\n",
"\n",
"TileLayer(tiles=r[\"tiles\"][0], opacity=1, attr=\"DigitalGlobe OpenData\").add_to(m)\n",
"\n",
"m"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "geo",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment