Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatial extension support #141

Open
VGSML opened this issue Aug 21, 2024 · 6 comments
Open

Spatial extension support #141

VGSML opened this issue Aug 21, 2024 · 6 comments
Labels
enhancement New feature or request
Milestone

Comments

@VGSML
Copy link

VGSML commented Aug 21, 2024

Do you plan to implement DuckDB spatial extension support, mainly ST_Read?
Will it be PostGIS types support?

@wuputah wuputah added long-term enhancement New feature or request labels Aug 22, 2024
@wuputah
Copy link
Collaborator

wuputah commented Aug 22, 2024

Yes, we would like to see spatial / GIS support, it's just a matter of time and priorities. Determining how it interacts with postgis will certainly need to be part of the design.

@VGSML
Copy link
Author

VGSML commented Aug 29, 2024

Thanks, will wait.

@JelteF JelteF added this to the Long term milestone Sep 30, 2024
@JelteF JelteF removed the long-term label Sep 30, 2024
@philiporlando
Copy link

+1 for PostGIS support!

@chong-spatial
Copy link

Does it support spatial extension yet?
looks like functions are not registered. I have run postgres=# select duckdb.install_extension('spatial'); first. But when I run postgres=# SELECT ST_AsText(ST_MakeEnvelope(0,0,1,1));
ERROR: function st_makeenvelope(integer, integer, integer, integer) does not exist
LINE 1: SELECT ST_AsText(ST_MakeEnvelope(0,0,1,1));
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

@VGSML
Copy link
Author

VGSML commented Nov 4, 2024

I think it won't work like your example. The main difficulty to implement is postgis—duckdb function mapping. In the PG should be used normal Postgis functions or duckdb functions from the schema duckdb. Postgis geometry is stored in the ewkb format, duckdb stores wkb - without srid and BBBox information, than could add additional difficulty.
Also there is no geography type in the duckdb spatial extension.

A lot of things to do ....

@JelteF JelteF modified the milestones: Long term, 0.3.0 Nov 6, 2024
@Maxxen
Copy link
Member

Maxxen commented Nov 9, 2024

I think it won't work like your example. The main difficulty to implement is postgis—duckdb function mapping. In the PG should be used normal Postgis functions or duckdb functions from the schema duckdb. Postgis geometry is stored in the ewkb format, duckdb stores wkb - without srid and BBBox information, than could add additional difficulty. Also there is no geography type in the duckdb spatial extension.

A lot of things to do ....

PostGIS doesn't store EWKB internally, and DuckDB doesn't store WKB internally either. Both use their own internal format and while they are not identical, the DuckDB format is very much inspired by PostGIS (both store BBOX:es). The major difference is that DuckDB does not store the SRID in the geometry value itself (and doesn't really have the concept of integer SRIDs in general).

I imagine the easiest solution is to just cast/convert to and from WKB when transferring geometries between DuckDB/PostGIS as ISO WKB basically models the common subset of spatial type support between the two systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants