CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-leafmap

A Python package for geospatial analysis and interactive mapping in a Jupyter environment.

54%

Overall

Evaluation54%

0.81x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-9/

Planet Imagery and NAIP Viewer

Build a helper module that assembles Planet mosaic imagery with NAIP downloads for a user-provided region and time window. The goal is to expose simple functions for visualizing the mosaics together and exporting results. Bounding boxes are tuples in the order (min_lon, min_lat, max_lon, max_lat).

Capabilities

Compose imagery map

  • Given a bounding box and a period string (YYYY-MM month or YYYY-Q# quarter), return an interactive map containing a Planet mosaic layer and an NAIP layer clipped to the region, with layer control and optional ROI highlight. @test

Export map view

  • Saving the map to HTML produces a file that opens with both imagery sources available to toggle and preserves center/zoom. @test

Download NAIP imagery

  • Downloading NAIP data for a bounding box and year writes a GeoTIFF to the requested path and returns the written file path. @test

Summarize imagery sources

  • A helper returns identifiers or URLs describing which Planet mosaic and NAIP asset were selected for the given inputs. @test

Implementation

@generates

API

from pathlib import Path
from typing import Dict, Any, Optional, Tuple
import leafmap

BBox = Tuple[float, float, float, float]


def build_planet_map(bounds: BBox, period: str, roi_geojson: Optional[Dict[str, Any]] = None) -> leafmap.Map:
    """Create an interactive map with Planet imagery for the period and NAIP coverage over the bounds. Adds the ROI if provided and raises ValueError for malformed inputs."""


def save_map_html(map_obj: leafmap.Map, output_path: Path) -> Path:
    """Persist the map to an HTML file that keeps the Planet and NAIP layers and returns the written path."""


def download_naip(bounds: BBox, year: int, destination: Path) -> Path:
    """Download NAIP imagery covering the bounds for the year to a GeoTIFF at destination; ensure the file exists and raise an error on failures."""


def summarize_sources(bounds: BBox, period: str, year: int) -> Dict[str, str]:
    """Return metadata describing the selected Planet mosaic and NAIP asset for the inputs."""

Dependencies { .dependencies }

leafmap { .dependency }

Provides Planet imagery layers, NAIP download helpers, and interactive mapping widgets.

tessl i tessl/pypi-leafmap@0.52.0

tile.json