Skip to content

ST_Normalize

Returns the geometry or geography in its canonical form.

Usage

geometry ST_Normalize(geom: geometry)
geography ST_Normalize(geog: geography)

Arguments

  • geog (geography): Input geography
  • geom (geometry): Input geometry

This function is mostly useful for testing and may rearrange vertices within a ring or interior rings within a polygon.

Examples

SELECT ST_Normalize(
    ST_GeomFromWKT('POLYGON ((10 10, 10 0, 0 0, 0 10, 10 10))')
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_normalize(st_geomfromwkt(Utf8("POLYGON ((10 10, 10 0, 0 0, 0 10, 10 10))" │
│                                     )))…                                     │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POLYGON((0 0,0 10,10 10,10 0,0 0))                                           │
└──────────────────────────────────────────────────────────────────────────────┘
SELECT ST_Normalize(
    ST_GeogFromWKT('POLYGON ((10 10, 10 0, 0 0, 0 10, 10 10))')
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_normalize(st_geogfromwkt(Utf8("POLYGON ((10 10, 10 0, 0 0, 0 10, 10 10))" │
│                                     )))…                                     │
╞══════════════════════════════════════════════════════════════════════════════╡
│ POLYGON((0 0,0 10,10 10,10 0,0 0))                                           │
└──────────────────────────────────────────────────────────────────────────────┘