developmentseed / developmentseed/lonboard

Validate geoarrow data type?

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

Description

This example silently renders nothing because the default numpy data type is int64, not float64. Setting `dtype=np.float64` fixes rendering. We should have some sort of validation about the data type.

```py
import numpy as np
from lonboard import ScatterplotLayer, Map
import pyarrow as pa

lon = np.array([1, 2, 3, 4])
lat = np.array([1, 2, 3, 4])

np_coords = np.column_stack([lon, lat])
flat_coords = pa.array(np_coords.ravel("C"))
points = pa.FixedSizeListArray.from_arrays(flat_coords, 2)
field = pa.field(
"geometry", points.type, metadata={b"ARROW:extension:name": b"geoarrow.point"}
)
table = pa.Table.from_arrays([points], schema=pa.schema([field]))

layer = ScatterplotLayer(table=table, get_fill_color=[255, 0, 0], radius_min_pixels=10)
m = Map(layer)
m
layer.radius_min_pixels = 10
layer.get_fill_color = [255, 0, 0]
pa.table( layer.table)
```

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.