Skip to content

User interface#93

Draft
Cidree wants to merge 41 commits intodevfrom
feature/user-interface
Draft

User interface#93
Cidree wants to merge 41 commits intodevfrom
feature/user-interface

Conversation

@Cidree
Copy link
Owner

@Cidree Cidree commented Feb 7, 2026

Overview

This PR refers to what has been discussed in #92.

I implemented what I explained in this comment, so we can experiment from there.

This is not the definitive approach, as we still need to discuss if this is the best way, and find if there are weaknesses in this method before moving forward.

I will describe the 2-type approach to implement macros.

Simple functions

They just have a 1-to-1 function relationship. For example:

CREATE OR REPLACE MACRO ddbs_is_simple(geom) AS ST_IsSimple(geom);

That will fully integrate ddbs_is_simple().

Complex functions

Those that use one duckspatial function to execute more than 1 DuckDB functions. For example, ddbs_area() uses ST_Area() or ST_Area_Spheroid() depending on the CRS. Therefore, I implemented a macro that will use one or the other depending on the CRS, found in the crs_duckspatial column:

CREATE OR REPLACE MACRO ddbs_area(geom) AS (
      CASE 
        WHEN crs_duckspatial = 'EPSG:4326' THEN ST_Area_Spheroid(ST_FlipCoordinates(geom))
        ELSE ST_Area(geom)
      END
    );

This has an obvious flaw: if the CRS is stored in a different column name, it won't work. However, I wouldn't give so much of impotance to this. When DuckDB v1.5.0 is released, that will be replaced by ST_SRID() or whichever will be the function that returns the CRS.

@Cidree Cidree self-assigned this Feb 7, 2026
@Cidree Cidree requested a review from e-kotov February 7, 2026 17:25
@Cidree
Copy link
Owner Author

Cidree commented Feb 7, 2026

By the way, only the last 3 commits are related to this PR.

@Cidree Cidree mentioned this pull request Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant