Gdf2Bokeh
An easy way to map your geographic data (from a GeoDataFrame, a DataFrame and a list of dictionaries containing wkt or shapely geometries).
Yeah! Because it's boring to convert shapely geometry to bokeh format each time I need to map something !!
Also, this library let you to build complex Bokeh dashboard: no limitations to use Bokeh mecanisms.
Check the demo here
How to install it ?
with pip
pip install gdf2bokeh
With Anaconda
conda install -c amauryval gdf2bokeh
How to use it ?
Gdf2Bokeh is able to map your data from various format. About data, you must be aware to use compliant geometry types:
It supports Geo/DataFrame/List of dict/List of geometry containing these 4 geometries families:
- Point data with Point geometry
- MultiPoint data with MultiPoint geometry
- Line data with LineString and/or MultiLineString geometries
- Polygon data with Polygon and/or MultiPolygon geometries
GeometryCollection data are not supported, so explode it to use it. So the best practice consists to split your input data by geometry type.
And you'll be able, optionally, to style your data thanks to the bokeh arguments : Check bokeh documentation in order to style your data :
- Point / MultiPoint families: bokeh marker style options
- Line family: bokeh multi_line style options
- Polygon family: bokeh multi_polygon style options
A simple example
from bokeh.plotting import show
import geopandas as gpd
import paandas as pd
from gdf2bokeh import Gdf2Bokeh
map_session = Gdf2Bokeh()
# add your layer from your data
# Map a points GeoDataFrame. You can see marker style arguments, so we suppose that input_data contains Point geometry
map_session.add_layer_from_geodataframe("layer1", gpd.GeoDataFrame.from_file("your_poins_data.geojson"),
size=6, fill_color="red", line_color="blue")
# Map from a DataFrame. Style parameters are not required
map_session.add_layer_from_dataframe("layer2", pd.DataFrame.from_file("your_data.json"),
geom_column="geometry", geom_format="shapely")
# Map from a list of dictionnaries
map_session.add_layer_from_dict_list("layer3",
[
{"geometry": "POINT(0 0)", "col1": "value1"},
{"geometry": "POINT(1 1)", "col1": "value2"}
],
geom_column="geometry", geom_format="wkt")
# Map from a geometry (shapely, wkt...) list
map_session.add_layer_from_geom_list("layer4", ["Point(0 0)", "Point(5 5)"], geom_format="wkt")
# Let's go to register them on bokeh
map_session.add_layers_on_map()
# Next, the map is displayed
show(map_session.figure)
Here a bokeh basic example. On the terminal, run :
python examples/bokeh_simple_case_example.py
Or you can use the jupyter notebook 'example.ipynb'
An advanced example
Here a bokeh serve example with a slider widget. On the terminal, run :
bokeh serve --show examples/bokeh_serve_example.py
Metadata
Release files for gdf2bokeh 3.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gdf2bokeh-3.3.0.tar.gz | 8.6 kB | Without provenance | Details for gdf2bokeh-3.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gdf2bokeh-3.3.0-py3-none-any.whl | Python 3 | none | any | Details for gdf2bokeh-3.3.0-py3-none-any.whl |
Total release size: 17.3 kB
Release files / gdf2bokeh-3.3.0.tar.gz
| Download URL | gdf2bokeh-3.3.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f0e25667e37c8a3e4276f508c9abd322ca6b673372262879be228401c8a11b4
|
|
BLAKE2b-256 checksum How to use checksums |
a36462a7eeeefd69be975390112cedf560c95b1e4c3b5e236a3e1d5b23756a7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0 CPython/3.13.1 Linux/6.8.0-1017-azure
|
Release files / gdf2bokeh-3.3.0-py3-none-any.whl
| Download URL | gdf2bokeh-3.3.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1aae2060aab54cc8a8d76ec31da770eb27d7f9786eb4f05b2757608ea8d09754
|
|
BLAKE2b-256 checksum How to use checksums |
fb0c3a431016a4443ed0750fbc2b67eac6bbfc42feb2a758bf431f365e9bb4de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0 CPython/3.13.1 Linux/6.8.0-1017-azure
|
Security for gdf2bokeh 3.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.