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 (including managed/shared hubs) is served by a Jupyter Server extension bundled with geolibre at {base_url}geolibre/app/, enabled automatically on pip install geolibre with no jupyter-server-proxy and no extra port. Because the extension is loaded at server startup, restart an already-running Jupyter server after installing geolibre for it to take effect. On other remote servers (Binder, remote JupyterLab), pass Map(server_proxy=True) to use that same route; 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.1.tar.gz (49.4 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.1-py3-none-any.whl (49.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: geolibre-1.1.1.tar.gz
  • Upload date:
  • Size: 49.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for geolibre-1.1.1.tar.gz
Algorithm Hash digest
SHA256 8d7bfb79dcace753a1866e35be2f871309bef939b492c7d22585578a539dbc75
MD5 472d43848231e73f007e173cbaa939b4
BLAKE2b-256 0b8af01e2c6c641acc66c9952d92a085c9c048ef8b4c3f9098533ce761902502

See more details on using hashes here.

File details

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

File metadata

  • Download URL: geolibre-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 49.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for geolibre-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fddd00c089965e1efd41728f31e66cc7f47ef6cf31235257afd4bdb7c1e8344f
MD5 ea225c658d1276444139e5779c13b356
BLAKE2b-256 eeb422f4ac878b422f3b7dd54b35a287577ee57e30f35ab43e5bc5c7fd69adfc

See more details on using hashes here.

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