Skip to content

Add support for creating local TiTiler endpoint#1256

Merged
giswqs merged 5 commits into
masterfrom
titler
Nov 12, 2025
Merged

Add support for creating local TiTiler endpoint#1256
giswqs merged 5 commits into
masterfrom
titler

Conversation

@giswqs

@giswqs giswqs commented Nov 12, 2025

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings November 12, 2025 18:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds support for creating a local TiTiler endpoint, enabling users to run TiTiler as a background service within their Python environment for visualizing Cloud Optimized GeoTIFFs (COGs).

  • Added a new run_titiler() function that starts a local TiTiler server on an available port
  • Integrated the new functionality with the existing check_titiler_endpoint() function to support "local" as an endpoint option
  • Added new optional dependency group [titiler] with required packages titiler and uvicorn

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pyproject.toml Added titiler and uvicorn dependencies to raster extras and created new titiler optional dependency group; added jupyter-duckdb to duckdb extras
mkdocs.yml Added navigation entries for new local_titiler notebooks
leafmap/stac.py Implemented run_titiler() function and modified check_titiler_endpoint() to support local TiTiler instances
leafmap/maplibregl.py Imported run_titiler function for maplibre interface
leafmap/foliumap.py Imported run_titiler function for folium interface
docs/notebooks/109_local_titiler.ipynb Added example notebook demonstrating local TiTiler server usage with default leafmap
docs/maplibre/local_titiler.ipynb Added example notebook demonstrating local TiTiler server usage with maplibre backend
docs/maplibre/overview.md Added documentation section for the new local TiTiler server feature
Comments suppressed due to low confidence (1)

leafmap/stac.py:2613

  • The function always returns None when return_titiler_endpoint=False (the default), but the docstring states it returns tuple: (endpoint, port, process). This inconsistency could confuse users. Either update the docstring to indicate it returns None by default or tuple when return_titiler_endpoint=True, or change the default behavior to always return the tuple.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mkdocs.yml Outdated
Comment thread leafmap/stac.py Outdated
"""
if titiler_endpoint is None:
if titiler_endpoint is not None and titiler_endpoint.lower() == "local":
titiler_endpoint, _, _ = run_titiler(show_logs=False)

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to run_titiler(show_logs=False) expects a tuple return value, but run_titiler returns None when return_titiler_endpoint=False (its default). This will cause an error attempting to unpack None. You should pass return_titiler_endpoint=True to ensure the tuple is returned: titiler_endpoint, _, _ = run_titiler(show_logs=False, return_titiler_endpoint=True)

Suggested change
titiler_endpoint, _, _ = run_titiler(show_logs=False)
titiler_endpoint, _, _ = run_titiler(show_logs=False, return_titiler_endpoint=True)

Copilot uses AI. Check for mistakes.
Comment thread pyproject.toml Outdated
Comment thread leafmap/stac.py
Comment on lines +2521 to +2526
def run_titiler(
show_logs: bool = False,
start_port: int = 8000,
max_port: int = 8100,
return_titiler_endpoint: bool = False,
):

Copilot AI Nov 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixing implicit and explicit returns may indicate an error, as implicit returns always return None.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 12, 2025

Copy link
Copy Markdown

giswqs and others added 2 commits November 12, 2025 14:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@giswqs giswqs linked an issue Nov 12, 2025 that may be closed by this pull request
@github-actions github-actions Bot temporarily deployed to pull request November 12, 2025 19:08 Inactive
@giswqs giswqs merged commit af50819 into master Nov 12, 2025
16 checks passed
@giswqs giswqs deleted the titler branch November 12, 2025 19:10
giswqs added a commit that referenced this pull request Dec 6, 2025
* Add support for creating local TiTiler endpoint

* Remove jupyter-duckdb

* Update pyproject.toml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update endpoint

* Update mkdocs.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update MapLibre cog method

2 participants