Skip to content

feat: Initial RasterLayer#1082

Merged
kylebarron merged 30 commits intomainfrom
kyle/cog-layer-2026
Feb 4, 2026
Merged

feat: Initial RasterLayer#1082
kylebarron merged 30 commits intomainfrom
kyle/cog-layer-2026

Conversation

@kylebarron
Copy link
Member

@kylebarron kylebarron commented Jan 23, 2026

Change list

  • Initial RasterLayer
  • User passes in an async callback for fetching tile data and a sync callback for rendering given each tile
  • deck.gl makes request for each tile. That request is sent to Python over the Jupyter comm. Then the layer receives the tile request, calls each callback, and sends data back to the frontend.
  • For now this only supports web mercator tiling, but that will be fixed in a future PR
  • In the future,
    • the from_async_geotiff method will define its own fetch_tile callback before passing to cls()
    • We should ensure that the abort signal is sent to cancel any Python requests.
    • We may want per-tile caching on the Python side?

Example with OSM data:

Screen.Recording.2026-02-04.at.2.54.54.PM_1080p.mov
from lonboard import viz, Map
from lonboard import RasterLayer
from aiohttp import ClientSession

OSM_URL = "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
headers = {
    "User-Agent": "Lonboard/0.1 (+https://developmentseed.org/lonboard/latest/)"
}

session = ClientSession(headers=headers)

async def fetch_tile(x, y, z):
    url = OSM_URL.format(x=x, y=y, z=z)
    resp = await session.get(url)
    return await resp.read()

def render_tile(data):
    return data

layer = RasterLayer(
    fetch_tile=fetch_tile,
    render=render_tile
)

Map(layer)

@kylebarron kylebarron changed the title proof of concept for async data fetching from Python -> JS feat: Initial RasterLayer Feb 4, 2026
@github-actions github-actions bot added the feat label Feb 4, 2026
@kylebarron kylebarron merged commit 4107b38 into main Feb 4, 2026
5 checks passed
@kylebarron kylebarron deleted the kyle/cog-layer-2026 branch February 4, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant