lonboard icon indicating copy to clipboard operation
lonboard copied to clipboard

Add SedonaDB to ecosystem

Open MrPowers opened this issue 2 months ago • 7 comments

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!

MrPowers avatar Sep 28 '25 17:09 MrPowers

Sure, would you like to make a PR?

kylebarron avatar Sep 29 '25 10:09 kylebarron

Sure, will submit a PR. I am experimenting with some examples and will try to make one that's cool!

MrPowers avatar Sep 30 '25 16:09 MrPowers

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:

Image

Here's what the map looks like when it is zoomed out:

Image

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?

MrPowers avatar Oct 27 '25 14:10 MrPowers

https://developmentseed.org/lonboard/latest/api/layers/scatterplot-layer/#lonboard.ScatterplotLayer.radius_min_pixels

kylebarron avatar Oct 27 '25 15:10 kylebarron

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!

MrPowers avatar Oct 27 '25 15:10 MrPowers

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/

kylebarron avatar Oct 27 '25 18:10 kylebarron

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

kylebarron avatar Oct 27 '25 18:10 kylebarron