Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate geoarrow data type? #608

Open
kylebarron opened this issue Aug 20, 2024 · 0 comments
Open

Validate geoarrow data type? #608

kylebarron opened this issue Aug 20, 2024 · 0 comments

Comments

@kylebarron
Copy link
Member

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.

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant