Skip to main content

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, VS Code, and Google Colab (Colab routes through its built-in port proxy automatically). Other remote setups (JupyterHub, Binder) where the browser cannot reach the kernel's localhost and no port proxy is configured are not yet supported.
  • Optional extras: pip install geolibre[all] adds GeoPandas/Shapely support for add_geojson(geodataframe).

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-0.2.0.tar.gz (23.9 MB view details)

Uploaded Source

Built Distribution

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

geolibre-0.2.0-py3-none-any.whl (24.1 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for geolibre-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ee4e95201d908210f27bf69ac5bc7ed7d8b6e56ea3356384b594f6d0f8338651
MD5 030720b489776c5efef7a7f4cce8e500
BLAKE2b-256 26c9249dda7d764115d8c005c72577f59be6b5d5ab5d4de0e4bcf9f7b412489d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for geolibre-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5e0b371fb1f6e4368d2a2438d4a31be47a540f3b9c2ff6db85bdc4899ace1fe
MD5 a54b939d0493e89bafbf509932735517
BLAKE2b-256 322fde7ef96210d185b184a54bf340fbee8fc483ac76bb5fe97d604107c254d4

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