Skip to main content

GeoLibre in Jupyter: the full GeoLibre GIS app as an anywidget, with a leafmap-style Python API.

Project description

geolibre

image image image Conda Recipe

GeoLibre in Jupyter: the full GeoLibre GIS app as an anywidget, with a leafmap-style Python API.

The widget embeds the complete GeoLibre app (menus, panels, processing tools) inside a notebook cell. State syncs both ways through a single .geolibre.json project, so data you add from Python appears in the UI, and edits you make in the UI are readable back from Python.

Install

pip install geolibre

Or with conda from conda-forge:

conda install -c conda-forge geolibre

Quickstart

from geolibre import Map

m = Map(center=(-100, 40), zoom=4)
m.add_geojson("https://example.com/data.geojson", name="Data")
m

Add more data and drive the view:

m.add_tile_layer(
    "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
    name="OpenStreetMap",
    attribution="(c) OpenStreetMap contributors",
)
m.add_cog("https://example.com/dem.tif", name="DEM", colormap="terrain")
m.add_basemap("dark")
m.set_center(-120, 47, zoom=8)

Round-trip the project:

m.save_project("my-map.geolibre.json")

m2 = Map()
m2.load_project("my-map.geolibre.json")

# Read state edited in the UI (e.g. after panning/zooming):
m.to_project()["mapView"]["center"]

API

Method Description
Map(center, zoom, basemap=, height=, layout=, theme=) Create a map. layout is "embed", "full", or "maponly".
add_geojson(data, name=, **style) Add GeoJSON (dict, path, URL, JSON, or GeoDataFrame).
add_tile_layer(url, name=, tile_size=, attribution=) Add a raster XYZ tile layer.
add_cog(url, name=, bands=, colormap=, rescale=) Add a Cloud Optimized GeoTIFF.
add_basemap(basemap) Set the background basemap.
set_center(lng, lat, zoom=None) Center (and optionally zoom) the map.
set_center_zoom(lng, lat, zoom=None) Alias of set_center (leafmap compatibility).
remove_layer(layer_id) / clear_layers() Remove layers.
to_project() / load_project(src) / save_project(path) Project I/O.

Notes

  • The bundled app is served from a localhost HTTP server, so the interactive widget works in local Jupyter and VS Code directly. Google Colab routes through its built-in port proxy automatically. JupyterHub routes through jupyter-server-proxy automatically (install it with pip install "geolibre[hub]"). On other remote servers (Binder, remote JupyterLab), pass Map(server_proxy=True) (also needs jupyter-server-proxy); Map(server_proxy=False) forces the direct path.
  • Optional extras: pip install geolibre[all] adds GeoPandas/Shapely support for add_geojson(geodataframe).
  • add_geojson inlines file/URL data into the project (up to 50 MB), so a large dataset is held in memory and re-synced on every project update. For very large layers, prefer a tile or COG source (add_tile_layer/add_cog) the app fetches directly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geolibre-1.1.0.tar.gz (24.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geolibre-1.1.0-py3-none-any.whl (24.5 MB view details)

Uploaded Python 3

File details

Details for the file geolibre-1.1.0.tar.gz.

File metadata

  • Download URL: geolibre-1.1.0.tar.gz
  • Upload date:
  • Size: 24.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for geolibre-1.1.0.tar.gz
Algorithm Hash digest
SHA256 644af1bacfb3ba272efd551b60bac9d434989dbbf962c6c253f80bad457e5bea
MD5 d024518c1ef2143c567b3eb233b2ea9e
BLAKE2b-256 11baa92f7964a980413c8f6d444363aba1982144fedbacd6b145a6af83a5928b

See more details on using hashes here.

Provenance

The following attestation bundles were made for geolibre-1.1.0.tar.gz:

Publisher: publish-python.yml on opengeos/GeoLibre

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geolibre-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: geolibre-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for geolibre-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8aa5ac96518596231a4f3ee6240577e3251833fd093dde75ccf3eab694831f49
MD5 95a68d56c6c58ba5b8d95511dd6e7e73
BLAKE2b-256 3b3acc660109b03414f01040af82f9c63486d274f1eadba5d69c5b397c6e8bcb

See more details on using hashes here.

Provenance

The following attestation bundles were made for geolibre-1.1.0-py3-none-any.whl:

Publisher: publish-python.yml on opengeos/GeoLibre

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page