Skip to content

Width and height of retangular polygons #843

Description

@marklit
COPY (
    SELECT
        *,
        width:
            ST_Distance_Spheroid(
                ST_POINT(ST_XMIN(geometry), ST_YMIN(geometry)),
                ST_POINT(ST_XMAX(geometry), ST_YMIN(geometry))
            ) / 1000,

        height:
            ST_Distance_Spheroid(
                ST_POINT(ST_XMIN(geometry), ST_YMIN(geometry)),
                ST_POINT(ST_XMIN(geometry), ST_YMAX(geometry))
            ) / 1000
    FROM 'Thu__18_Jun_2026_15_59_31_GMT.parquet'
    limit 10
) TO 'width_height.parquet' (
    FORMAT 'PARQUET',
    CODEC  'ZSTD',
    COMPRESSION_LEVEL 22,
    ROW_GROUP_SIZE 15000);

The width and height calculated above appear to be 1.5-2x what QGIS is measuring.

Image

Is there a better ST_FUNCTION or way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions