duckdb / duckdb_spatial

MIT License
489 stars 40 forks source link

Find spatial reference of a geometry column #276

Open markruddy opened 8 months ago

markruddy commented 8 months ago

Hi, is there an equivalent of the PostGIS statement:

SELECT ST_SRID(geom) FROM my_table;

In duckdb spatial extension? I'd like to be able to query the SRS of tables to troubleshoot spatial queries but can't find ST_SRID implemented(?) Is there an alternative approach to get this information through table properties?

Many thanks

Maxxen commented 8 months ago

Hi! duckdb spatial does not store the SRID inside the geometry type, its recommended to keep it in a separate column for now and in the future ST_Read might be able to output it as well. But for now you can use st_read_meta in combination with UNNEST to extract the projection information from a st_read compatible dataset.