Add SedonaDB to ecosystem
SedonaDB works with lonboard, see this example notebook.
Can we add SedonaDB to the lonboard ecosystem docs? I can submit a PR if folks think this is a good idea!
Sure, would you like to make a PR?
Sure, will submit a PR. I am experimenting with some examples and will try to make one that's cool!
I created a SedonaDB + lonboard map to visualize swimming pools in NYC using Overture data. It looks cool when it's zoomed in and I wanted to know how to get the dots to show when it's zoomed out.
Here's what the map looks like when it's zoomed in on Mill Basin:
Here's what the map looks like when it is zoomed out:
Here's the code:
sd = sedona.db.connect()
df = sd.read_parquet(
"/Users/matthewpowers/data/overture/base_water.parquet"
)
df.to_view("base_water", True)
nyc = "POLYGON((-74.26 40.50, -74.26 40.92, -73.70 40.92, -73.70 40.50, -74.26 40.50))"
query = f"""
select * from base_water
where
ST_Within(geometry, ST_SetSRID(ST_GeomFromText('{nyc}'), 4326))
and source_tags['leisure'] = 'swimming_pool'
"""
res = sd.sql(query)
viz(res)
Can I get the dots to show up at the different zoom settings?
https://developmentseed.org/lonboard/latest/api/layers/scatterplot-layer/#lonboard.ScatterplotLayer.radius_min_pixels
I switched to this:
layer = ScatterplotLayer(
res,
radius_min_pixels=5
)
m = Map(layer)
Then I got this error: AssertionError: Mixed geometry type input not supported here. Use the top level viz() function or separate your geometry types in advance.
Then I filtered res to only include polygons and got this error: TraitError: The 'table' trait of a ScatterplotLayer instance expected Expected one of geoarrow.point, geoarrow.multipoint geometry types, got b'geoarrow.polygon'., not the Table arro3.core.Table.
But it looks like it works well with the centroid, so thanks for pointing me in the right direction!
only include polygons
the scatterplot layer is for point data. Use the polygon layer for polygon data https://developmentseed.org/lonboard/latest/api/layers/polygon-layer/
Can I get the dots to show up at the different zoom settings?
I can't tell what you want. If you want to visualize polygons, and the polygons are small, then there's no obvious way to visualize them when zoomed out (but you can change the width settings if you want). Or, you can combine that with visualizing dots representing the polygons with the scatterplot layer