Skip to content

Conversation

@hafenkran
Copy link
Contributor

Switched ST_AsMVTGeom to orient polygons the right way after the Y‑flip, so exterior rings are CW and holes are CCW in tile coords (as per the MVT spec). Added tests covering a polygon, a polygon with a hole, and a multipolygon to lock this in.

Example:

D SELECT ST_AsText(
      ST_AsMVTGeom(
          ST_GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'),
          ST_Extent(ST_GeomFromText('POLYGON((0 0, 2 0, 2 2, 0 2, 0 0))')),
          4096
      )
  );
┌──────────────────────────────────────────────────────────────────────────────────────────┐
│ st_astext(st_asmvtgeom(st_geomfromtext('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'), st_exten…  │
│                                         varchar                                          │
├──────────────────────────────────────────────────────────────────────────────────────────┤
│ POLYGON ((2048 4096, 0 4096, 0 2048, 2048 2048, 2048 4096))                              │
└──────────────────────────────────────────────────────────────────────────────────────────┘

Closes #731

@Maxxen
Copy link
Member

Maxxen commented Jan 8, 2026

Thanks for the PR! LGTM!

@Maxxen Maxxen merged commit a58746c into duckdb:v1.4-andium Jan 8, 2026
10 of 12 checks passed
@Maxxen
Copy link
Member

Maxxen commented Jan 8, 2026

(don't worry about the windows failure, I will have to deal with it myself soon anyway)

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.

ST_AsMVTGeom outputs CCW exterior rings in tile coords

2 participants