GeoLibre in Jupyter: the full GeoLibre GIS app as an anywidget, with a leafmap-style Python API.
Project description
geolibre
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
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. |
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. Remote setups (JupyterHub, Colab)
where the browser cannot reach the kernel's
localhostare not yet supported. - Optional extras:
pip install geolibre[all]adds GeoPandas/Shapely support foradd_geojson(geodataframe).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geolibre-0.1.0.tar.gz.
File metadata
- Download URL: geolibre-0.1.0.tar.gz
- Upload date:
- Size: 26.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25dc58befb2d9d982ff4bf4f704d0dcb245b71a30fba31c5348d97a8688cbb0a
|
|
| MD5 |
50d3e6236691657eeb891f60256b41c1
|
|
| BLAKE2b-256 |
c4722a02eee98c596ae2149242666fff01d1e4076199c77641b95553e347d46b
|
File details
Details for the file geolibre-0.1.0-py3-none-any.whl.
File metadata
- Download URL: geolibre-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5a9f20357f6ae9a0304ddc8a9b3ae1c91c864ff74c83eb7ad2d2a2c3347c5ca
|
|
| MD5 |
1415fbcb6412fb5c1b33fd7ca57f8157
|
|
| BLAKE2b-256 |
ee84ccdd42559eace1f1abd00e2c8875f0f1df66e93834f895ddb1a61a2957fa
|