Skip to content

Support from_duckdb with no property columns #622

Closed
@kylebarron

Description

Discussed in #619

Originally posted by aborruso September 2, 2024
Hi,
if in my below code I remove the id_bene field and thus only one geom field is present

sql = """
CREATE TABLE rides AS
SELECT
  id_bene,ST_Point(longitudine, latitudine) as geom
FROM
  parquet_scan('../data/beni_immobili_pubblici_geo.parquet');
"""

con.execute(sql)

con.table("rides")

layer = HeatmapLayer.from_duckdb(con.table("rides"), con)

m = Map(layer)
m

I have these errors

AttributeError                            Traceback (most recent call last)
Cell In[11], line 24
     20 con.execute(sql)
     22 con.table("rides")
---> 24 layer = HeatmapLayer.from_duckdb(con.table("rides"), con)
     26 m = Map(layer)
     27 m

File ~/.local/lib/python3.11/site-packages/lonboard/_layer.py:1689, in HeatmapLayer.from_duckdb(cls, sql, con, crs, **kwargs)
   1680 @classmethod
   1681 def from_duckdb(
   1682     cls,
   (...)
   1687     **kwargs: Unpack[HeatmapLayerKwargs],
   1688 ) -> Self:
-> 1689     return super().from_duckdb(sql=sql, con=con, crs=crs, **kwargs)

File ~/.local/lib/python3.11/site-packages/lonboard/_layer.py:372, in BaseArrowLayer.from_duckdb(cls, sql, con, crs, **kwargs)
    370     table = _from_duckdb(rel, con=con, crs=crs)
    371 else:
--> 372     table = _from_duckdb(sql, con=con, crs=crs)
    374 return cls(table=table, **kwargs)

File ~/.local/lib/python3.11/site-packages/lonboard/_geoarrow/_duckdb.py:57, in from_duckdb(rel, con, crs)
...
     95     geom_col_name = rel.columns[geom_col_idx]
     97     # A poor-man's string interpolation check
     98     # We can't pass in SQL-templated strings for the column name

AttributeError: 'NoneType' object has no attribute 'arrow'

Why is it not possible to have a heatmap from only a geom field?

If it were possible, I would enable it.

Thank you for this great product

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions