SQL Reference
Geospatial Functions
Attribute Functions
{{ocientgeo}} attribute functions return descriptive information on the specified data set st coorddim alias for st ndims or st ndimension returns an integer of the coordinate dimension of the specified geography syntax st coorddim(geo) 100,191,371 trueleft 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 coorddim(st polygon('polygon((1 1, 2 1, 2 2, 1 1))')); output 2 st dimension returns an integer that represents the dimension of the specified geography this table describes the result values of the st dimension function trueleft 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 left unhandled content type the st dimension function always returns 0 for non empty point objects for non empty linestring and polygon objects, the st dimension function returns the dimension value equal to the greatest dimension represented by their bounding points for example, a linestring or polygon object that contains only a single point returns 0 similarly, a polygon object can return 1 if it contains insufficient points to represent a closed polygon syntax st dimension(geo) trueleft 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 evaluates a linestring with an empty point value select st dimension(st linestring('point empty')); output 1 in this example, the function evaluates a linestring with a single point value select st dimension(st linestring('st point(0 0)')); output 0 this example evaluates an empty linestring select st dimension(st linestring('linestring empty')); output 1 in this example, the function again evaluates a linestring with a single point value select st dimension(st linestring('linestring(0 0)')); output 0 in this example, the function evaluates a linestring with multiple point values select st dimension(st linestring('linestring(0 0, 1 1)')); output 1 this example evaluates an empty polygon select st dimension(st polygon('polygon empty')); output 1 this example evaluates a polygon with a single point select st dimension(st polygon('polygon((1 1))')); output 0 this example evaluates a polygon with two point values select st dimension(st polygon('polygon((0 0, 1 1))')); output 1 this example evaluates a polygon with multiple point values, enough to close the polygon select st dimension(st polygon('polygon((0 0, 1 0, 1 1, 0 0))')); output 2 st geometrytype returns a string that represents the geometry of the input geospatial value supported values are st point , st linestring , and st polygon this function enforces the same strict dimension types as the attribute functions /#stdimension function if geo is null, then the function returns null syntax st geometrytype(geo) trueleft 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 geometrytype(st point(1, 2)); output st point st isempty returns true if the specified geography value is empty, such as 'polygon empty' a null input value returns null syntax st isempty(geo) trueleft 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 isempty(st polygon('polygon empty')); output true st memsize returns an integer representing the number of bytes in memory required to store the specified geography syntax st memsize(geo) trueleft 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 memsize(st point(1,1)); output 16 st ndims or st ndimension alias for attribute functions /#stcoorddim st npoints or st numpoints returns an integer representing the number of point values in a specified geography if the specified value is a polygon , this function counts the number of point values in both the exterior and any holes syntax st npoints(geo) st numpoints(geo) trueleft 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 npoints( st polygon( 'polygon((1 2, 1 3, 1 2))')); output 3 st srid returns the epsg code of the spatial reference identifier (srid) of the input geography all {{ocient}} geographies are of type gcs wgs 84, which is identified by the value 4326 there is no way to set a different srid syntax st srid(geo) trueleft 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 srid(st makepoint(1 1, 3 11)); output 4326 st x returns the x value, or longitude, of the specified point the returned value is a double type syntax st x(point) trueleft 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 x(st point(3, 5)); output 3 st xmax returns the maximum x value of the specified geography the returned value is a double type syntax st xmax(geo) trueleft unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example in this example, the st xmax function returns 2 because it is the largest x value of the specified points select st xmax( st polygon(st linestring('linestring(2 5, 1 2, 1 4, 0 3)'))); output 2 st xmin returns the minimum x value of the specified geography syntax st xmin(geo) trueleft unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example in this example, the st xmin function returns 0 because it is the smallest x value of the specified points select st xmin( st polygon(st linestring('linestring(2 5, 1 2, 1 4, 0 3)'))); output 0 st y returns the y value, or latitude, of the specified point the returned value is a double type syntax st y(point) trueleft 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 y(st point(3, 5)); output 5 st ymax returns the maximum y value of specified geography syntax st ymax(geo) trueleft unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example in this example, the st ymax function returns 5 because it is the largest y value of the specified points select st ymax( st polygon(st linestring('linestring(2 5, 1 2, 1 4, 0 3)'))); output 5 st ymin returns the minimum y value of specified geography syntax st ymin(geo) trueleft unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type example in this example, the st ymin function returns 2 because it is the smallest y value of the specified points select st ymin( st polygon(st linestring('linestring(2 5, 1 2, 1 4, 0 3)'))); output 2 related links data types docid\ ogtviwl gtbgv0chhrh 3 linestring constructors docid 276iafpj50xtsav3j0fte point constructors docid\ c aaugo19qr znvjihgsy polygon constructors docid\ bhntklcaesnevkgnxutqb