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
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_vector(data, name=, render_mode=, data_format=, source_layer=, **style) |
Add a vector dataset from a URL (GeoParquet, FlatGeobuf, zipped Shapefile, GeoJSON) or a local file (read via GeoPandas, inlined). |
add_geoparquet / add_flatgeobuf / add_shp (data, name=, **style) |
Format-specific wrappers over add_vector. |
add_vector_tiles(url, name=, source_layers=, source_layer=, **style) |
Add vector tiles from a TileJSON endpoint. |
add_pmtiles(url, name=, tile_type=, source_layers=, **style) |
Add a PMTiles archive (vector or raster). |
add_tile_layer(url, name=, tile_size=, attribution=) |
Add a raster XYZ tile layer. |
add_wms(endpoint, layers, name=, styles=, image_format=, transparent=, tile_size=, **style) |
Add a WMS (GetMap) tiled raster layer. |
add_wmts(url, name=, tile_size=, **style) |
Add a WMTS tile URL template. |
add_wfs(endpoint, type_name, name=, version=, output_format=, srs_name=, max_features=, **style) |
Add a WFS layer (GeoJSON, fetched and inlined). |
add_cog(url, name=, bands=, colormap=, rescale=) |
Add a Cloud Optimized GeoTIFF. |
add_raster(url, name=, bands=, colormap=, rescale=) |
Add a raster (alias of add_cog). |
add_3d_tiles(url, name=, altitude_offset=, request_headers=, **style) |
Add a 3D Tiles tileset.json. |
add_video(urls, coordinates, name=, **style) |
Add a georeferenced video (four [lng, lat] corners). |
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. On JupyterHub (including
managed/shared hubs) the front-end tries two same-origin routes and uses
whichever is live, so a host needs only one of them: the Jupyter Server
extension bundled with
geolibreat{base_url}geolibre/app/(enabled automatically onpip install geolibre, but registered only after the Jupyter server restarts), andjupyter-server-proxyat{base_url}proxy/{port}/(works in the running server with no restart where it is installed). On other remote servers (Binder, remote JupyterLab), passMap(server_proxy=True)to use that same remote path;Map(server_proxy=False)forces the direct path. - Optional extras:
pip install geolibre[all]adds GeoPandas/Shapely support foradd_geojson(geodataframe)and for reading local vector files (add_vector/add_geoparquet/add_flatgeobuf/add_shp), which the kernel reads and inlines as GeoJSON. Remote URLs for the same formats stream through the in-browser vector control and need no extras. add_geojsoninlines 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
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-1.9.0.tar.gz.
File metadata
- Download URL: geolibre-1.9.0.tar.gz
- Upload date:
- Size: 34.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4256e72f6340fdce9329370967e95940f1225646af328c0792fb722a8ecd2e3d
|
|
| MD5 |
e3787f98d39c2ae9e96be9dd9f478d52
|
|
| BLAKE2b-256 |
bfc05a570bd47f71442e424a17affdcc3e66bdaa527e28bda94367be0c27eacb
|
Provenance
The following attestation bundles were made for geolibre-1.9.0.tar.gz:
Publisher:
publish-python.yml on opengeos/GeoLibre
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geolibre-1.9.0.tar.gz -
Subject digest:
4256e72f6340fdce9329370967e95940f1225646af328c0792fb722a8ecd2e3d - Sigstore transparency entry: 2038454968
- Sigstore integration time:
-
Permalink:
opengeos/GeoLibre@71a3f20da00352ada02627abb3ce359eca10e94c -
Branch / Tag:
refs/tags/v1.9.0 - Owner: https://github.com/opengeos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@71a3f20da00352ada02627abb3ce359eca10e94c -
Trigger Event:
release
-
Statement type:
File details
Details for the file geolibre-1.9.0-py3-none-any.whl.
File metadata
- Download URL: geolibre-1.9.0-py3-none-any.whl
- Upload date:
- Size: 35.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
131fb55be871b7388858295c25fed9db245c4b4b818907389efc6db9b5b92cd1
|
|
| MD5 |
385db6d7ab7799e773ee826ebb1eb826
|
|
| BLAKE2b-256 |
67e25ceea7e65971ac0934011c90f2d8ab38f35a657e3fdf5d250aab8834d723
|
Provenance
The following attestation bundles were made for geolibre-1.9.0-py3-none-any.whl:
Publisher:
publish-python.yml on opengeos/GeoLibre
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geolibre-1.9.0-py3-none-any.whl -
Subject digest:
131fb55be871b7388858295c25fed9db245c4b4b818907389efc6db9b5b92cd1 - Sigstore transparency entry: 2038455764
- Sigstore integration time:
-
Permalink:
opengeos/GeoLibre@71a3f20da00352ada02627abb3ce359eca10e94c -
Branch / Tag:
refs/tags/v1.9.0 - Owner: https://github.com/opengeos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@71a3f20da00352ada02627abb3ce359eca10e94c -
Trigger Event:
release
-
Statement type: