ibis-project / ibis

the portable Python dataframe library
https://ibis-project.org
Apache License 2.0
5.24k stars 591 forks source link

feat: support st_read_meta (duckdb geospatial extension) #10377

Open cboettig opened 5 hours ago

cboettig commented 5 hours ago

Is your feature request related to a problem?

knowing the CRS (coordinate reference system) of our data is often a crucial bit of information. This information is already embedded inside all the spatial formats we read with read_geo() method in ibis. If we read these data with geopandas directly, the CRS is preserved and attached to the geopandas object as expected. But if we read these data via ibis / duckdb spatial (e.g. because perhaps the file is really large and we want to filter it first), .execute() gives us a geopandas object but with empty CRS attribute.

What is the motivation behind your request?

No response

Describe the solution you'd like

The duckdb spatial extension provides st_read_meta() for this and related metadata. Ideally, ibis read_geo could attempt to call st_read_meta() in some way as well, such that when the user materializes the data with execute(), it comes with .crs already correctly attached.

A simpler a probably necessary solution anyway would just be to have ibis bindings to the st_read_meta() method in duckdb (which can access additional metadata elements as well).

What version of ibis are you running?

9.5

What backend(s) are you using, if any?

duckdb + spatial extension

Code of Conduct

cboettig commented 5 hours ago

Maybe an aside, but there seems to be an issue (at least in my testing) in trying to call st_read_meta when using the virtual filesystem interface https://github.com/duckdb/duckdb_spatial/issues/269#issuecomment-2439748672