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-2/

Multi-backend Map Explorer

Create a small module that builds interactive maps that can switch between a notebook-friendly widget backend and an HTML-friendly backend while keeping overlays and controls consistent.

Capabilities

Create maps with selectable backend

  • Selecting the "widget" backend returns an interactive map centered at a provided latitude/longitude with the requested zoom, includes a default base layer, and exposes a layer toggle for overlays. @test
  • Selecting the "html" backend produces an export-ready map view with the same center and zoom and preserves room for controls and overlays. @test

Overlay GeoJSON data

  • Loading a GeoJSON file with two features adds them as a named overlay, applies a fill color style, and shows a tooltip for a chosen property in both backends. @test

Draw, measure, and search

  • Enabling interactive controls adds drawing tools that capture user-drawn polygons, a distance/area measurement widget, and a place search box with a custom placeholder across both backends. @test

Export interactive HTML

  • Exporting after adding an overlay and drawing a shape writes an HTML file that preserves the overlay, drawn geometry, and controls. @test

Implementation

@generates

API

from typing import Literal, Sequence, Mapping, Any

Backend = Literal["widget", "html"]

def create_map(backend: Backend, center: Sequence[float], zoom: int = 3) -> Any:
    """Create an interactive map using the selected backend with a base layer and overlay toggle."""

def add_geojson_overlay(map_obj: Any, geojson_path: str, style: Mapping[str, Any] | None = None, tooltip_field: str | None = None) -> None:
    """Load a GeoJSON file onto the map with optional styling and tooltip display."""

def enable_interactive_controls(map_obj: Any, search_placeholder: str = "Search for places") -> None:
    """Add drawing, measurement, and place search controls to the map."""

def export_map(map_obj: Any, output_html: str) -> str:
    """Save the interactive map (including overlays and user drawings) to an HTML file and return its path."""

Dependencies { .dependencies }

leafmap { .dependency }

Provides multi-backend interactive maps with built-in search, draw, and measurement controls for notebook and HTML outputs.

tessl i tessl/pypi-leafmap@0.52.0

tile.json