SQL Reference
Geospatial Functions
Polygon Constructors
{{ocientgeo}} polygon constructors use geospatial data to create a polygon object st forceccw creates a standardized polygon from an existing one {{ocient}} defines standardized as the exterior being counterclockwise (ccw) and all holes being clockwise (cw) oriented syntax st forceccw(polygon) 136,157,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st forceccw(st polygon('polygon((0 0,0 1,1 1,1 0,0 0))')); output polygon((0 0,1 0,1 1,0 1,0 0)) st makepolygon alias for docid 6s1zu ro01da1k 1py5xk st polygon creates a polygon st polygon(geo) creates a polygon from the specified point , point array, linestring , or polygon geography syntax st polygon(geo) 136,147,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st polygon( st linestring( st point \[]\( st point(1, 2), st point(1, 3), st point(1, 4), st point(1, 2)))); output polygon((1 2,1 3,1 4,1 2)) st polygon(char) alias for st makepolygon(char) creates a polygon from the specified char representing a polygon in wkt format syntax st polygon(char) 136,176,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st polygon('polygon((1 2,1 3,1 4,1 2))'); output polygon((1 2,1 3,1 4,1 2)) st polygon(binary) alias for st polygonfromwkb(binary) creates a polygon from the specified binary the binary value must represent a polygon in wkb format syntax st polygon(binary) 136,153,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st polygon(binary('0x01030000000100000005000000000000000000000000000000000000000000000000000000000000000000f03f000000000000f03f000000000000f03f000000000000f03f000000000000000000000000000000000000000000000000')); output polygon((0 0,0 1,1 1,1 0,0 0)) st polygon(outer ring, inner rings) alias for st makepolygon(outerring, innerrings) creates a polygon from the specified outer ring (that must be either a point , point array, or linestring ) and the array of interior rings (closed lines) the interior of the polygon is on the left when traveling around the exterior ring the interior of a hole is on the right when traveling around a hole syntax st polygon(outer ring, inner rings) 136,170,350 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st polygon( st linestring(st point \[]\(st point(1, 2))), st linestring \[]\(st linestring(st point \[]\(st point(1, 2))))); output polygon((1 000000 2 000000), (1 000000 2 000000)) st polygonfromwkb alias for docid 6s1zu ro01da1k 1py5xk st polygonfromewkt alias for the docid 6s1zu ro01da1k 1py5xk constructor creates a polygon using an ewkt formatted char as an input argument syntax st polygonfromewkt(char) 135,173,351 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example select st polygonfromewkt('srid=4326;polygon((1 2,1 3,1 4,1 2))'); output polygon((1 2,1 3,1 4,1 2)) st polygonfromgeojson creates a polygon represented by the specified geojson value as an input argument syntax st polygonfromgeojson(geojson \[, geodesic ] ) 135,140,352 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type examples in this example, the function produces an empty polygon value from the geojson representation select st polygonfromgeojson('{"type" "polygon","coordinates" \[]}',false); output polygon empty in this example, the function produces a polygon value from the geojson representation select st polygonfromgeojson( '{"type" "polygon","coordinates" \[\[\[1,1],\[1,5],\[5,5],\[5,1]]]}', false); output polygon((1 1, 1 5, 5 5, 5 1)) st polygonfromtext alias for docid 6s1zu ro01da1k 1py5xk st wholeearth returns the database internal representation of the whole earth polygon the docid\ pifo3jqjej4vo8mp3zkyd function returns this polygon value, with the envelope set as the entire earth gis specifications do not describe a canonical polygon for the whole earth, but this value serves as the ocient canonical polygon the whole earth polygon is also equivalent to st polygon('polygon((0 0,0 0,0 0,0 0'))) , which can have a separate meaning in other gis implementations syntax st wholeearth() example select st wholeearth(); output polygon((0 0 0 0, 0 0 0 0, 0 0 0 0, 0 0 0 0)) related links docid\ czxgepf3prq9ufwhwbiuy docid\ ln31h9xuiniz 9q3nd0m