developmentseed / developmentseed/lonboard

[BUG] Zero-size batches cause error

Open
#892 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
964
Forks
54
Avg merge
5m
Merged PRs (30d)
1

Description

## Context

I was expecting a map to be shown but got an error

## Resulting behaviour, error message or logs

**Describe what happened:**

```python
import geoarrow.pyarrow as ga
import lonboard
import pyarrow as pa

batch0 = pa.record_batch({"geom": ga.as_wkb(["POINT (0 1)"])})
batch1 = pa.record_batch({"geom": ga.as_wkb(pa.array([], pa.binary()))})
reader = pa.RecordBatchReader.from_batches(batch0.schema, [batch0, batch1])
lonboard.viz(reader)
#> ValueError: zero-size array to reduction operation minimum which has no identity
```

The example in https://github.com/developmentseed/lonboard/issues/891 surfaced a different issue:

```python
import lonboard
import sedona.db

sd = sedona.db.connect()
sd.read_parquet("https://github.com/geoarrow/geoarrow-data/releases/download/v0.2.0/ns-water_water-poly_geo.parquet").to_view("lakes")
sd.read_parquet("https://github.com/geoarrow/geoarrow-data/releases/download/v0.2.0/ns-water_water-line_geo.parquet").to_view("rivers")
sd.sql("""SELECT geometry AS lake FROM lakes WHERE "OBJECTID" = 1976""").to_view("east_lake")

inlets_and_outlets = sd.sql("""
SELECT "OBJECTID", "FEAT_CODE", geometry
FROM rivers
JOIN east_lake ON ST_Intersects(east_lake.lake, rivers.geometry)
""")

lonboard.viz(inlets_and_outlets)
#> ValueError: 0-length dimension not currently supported.
```

## Environment

- OS: MacOS 15
- Browser: VSCode
- Lonboard Version: See environment

```
MarkupSafe==3.0.2
adbc-driver-manager==1.8.0
anywidget==0.9.18
apache-sedona==1.8.0
appnope==0.1.4
arro3-compute==0.6.3
arro3-core==0.6.3
arro3-io==0.6.3
asttokens==3.0.0
attrs==24.3.0
beautifulsoup4==4.12.3
bleach==6.2.0
certifi==2024.12.14
comm==0.2.2
contourpy==1.3.3
cycler==0.12.1
debugpy==1.8.11
decorator==5.1.1
defusedxml==0.7.1
duckdb==1.1.3
executing==2.1.0
fastjsonschema==2.21.1
fonttools==4.60.0
geoarrow-c==0.3.0
geoarrow-pyarrow==0.2.0
geoarrow-rust==0.1.0
geoarrow-rust-compute==0.5.2
geoarrow-rust-core==0.5.2
geoarrow-rust-io==0.5.2
geoarrow-types==0.3.0
geopandas==1.0.1
ipykernel==6.29.5
ipython==8.31.0
ipywidgets==8.1.7
jedi==0.19.2
jinja2==3.1.5
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-client==8.6.3
jupyter-core==5.7.2
jupyterlab-pygments==0.3.0
jupyterlab-widgets==3.0.15
kiwisolver==1.4.9
lonboard==0.12.1
matplotlib==3.10.6
matplotlib-inline==0.1.7
mistune==3.1.0
nbclient==0.10.2
nbconvert==7.16.5
nbformat==5.10.4
nest-asyncio==1.6.0
numpy==2.2.1
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pillow==11.3.0
pip==24.3.1
platformdirs==4.3.6
prompt-toolkit==3.0.48
psutil==6.1.1
psycopg2-binary==2.9.10
psygnal==0.14.2
ptyprocess==0.7.0
pure-eval==0.2.3
py4j==0.10.9.7
pyarrow==21.0.0
pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.5
pyproj==3.7.0
pyspark==3.5.4
python-dateutil==2.9.0.post0
pytz==2024.2
pyzmq==26.2.0
referencing==0.35.1
rpds-py==0.22.3
sedonadb==0.1.0
setuptools==75.7.0
shapely==2.0.6
six==1.17.0
soupsieve==2.6
stack-data==0.6.3
tinycss2==1.4.0
tornado==6.4.2
traitlets==5.14.3
typing-extensions==4.15.0
tzdata==2024.2
wcwidth==0.2.13
webencodings==0.5.1
widgetsnbextension==4.0.14
autocommand==2.2.2
backports.tarfile==1.2.0
importlib-metadata==8.0.0
inflect==7.3.1
jaraco.collections==5.1.0
jaraco.context==5.3.0
jaraco.functools==4.0.1
jaraco.text==3.12.1
more-itertools==10.3.0
tomli==2.0.1
typeguard==4.3.0
wheel==0.43.0
zipp==3.19.2
```

## Steps to reproduce the bug

See above

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.