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) argument data type description geo point , linestring , or polygon the geospatial object used to calculate the dimensions 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 st dimension result value dimension type 1 empty geography value 0 point 1 linestring 2 polygon 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) argument data type description geo point , linestring , or polygon the geospatial object used to calculate the dimensions 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 /#stdimension function if geo is null, then the function returns null syntax st geometrytype(geo) argument data type description geo point , linestring , polygon a geospatial value to be identified by its dimension 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) argument data type description geo point , linestring , polygon a geospatial value to be examined if it is empty 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) argument data type description geo point , linestring , polygon a geospatial value to be measured by its data memory example select st memsize(st point(1,1)); output 16 st ndims or st ndimension alias for /#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) argument data type description geo point , linestring , polygon a geospatial value to be examined for its count of point values 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) argument data type description geo point , linestring , polygon a geospatial value to be analyzed for its epsg code 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) argument data type description point point a geospatial point to be analyzed for its x value, the longitude 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) argument data type description geo point , linestring , polygon one or more geospatial points to be analyzed for the maximum x value 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) argument data type description geo point , linestring , polygon one or more geospatial points to be analyzed for the minimum x value 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) argument data type description point point a geospatial point to be analyzed for its y value, the latitude example select st y(st point(3, 5)); output 5 st ymax returns the maximum y value of specified geography syntax st ymax(geo) argument data type description geo point , linestring , polygon one or more geospatial points to be analyzed for the maximum y value 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) argument data type description geo point , linestring , polygon one or more geospatial points to be analyzed for the minimum y value 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 docid\ ogtviwl gtbgv0chhrh 3 docid 276iafpj50xtsav3j0fte docid\ c aaugo19qr znvjihgsy docid\ bhntklcaesnevkgnxutqb