SQL Reference
Geospatial Functions
Point Constructors
{{ocientgeo}} point constructors use geospatial data to create a point object st centroid returns a point that is the geographic center of mass of a specified geospatial object the geographic center of mass is calculated by taking the average of all points on a three dimensional sphere, projecting the resultant point onto the sphere, and converting it back to latitude and longitude coordinates syntax st centroid( geo \[, use spheroid ] ) argument data type description geo point , linestring , or polygon a geospatial object that the function analyzes to compute its geometric center use spheroid boolean optional if this argument is true , the function computes the centroid using a spheroid model instead of a spherical model if you do not specify this value, the value defaults to false example select st centroid(st polygon('polygon((1 1, 2 1, 2 2, 1 1))')); output point(1 66 1 33) st geogpoint alias for st polygon(st linestring(array(st point(lon, lat)))) creates and returns a polygon geography with a single point, defined by the longitude and latitude specified for the function syntax st geogpoint(lon, lat) argument data type description lon double a longitude coordinate to be used to create a polygon with a single point lat double a latitude coordinate to be used to create a polygon with a single point example select st geogpoint(41 882548, 87 63922); output polygon((41 882548 87 63922)) st makepoint alias for /#stpoint st point creates a point from the specified input arguments st point(binary) alias for st pointfromwkb creates a point from the specified binary value, which must represent a point in wkb format syntax st point(binary) argument data type description binary binary a binary value in wkb format that represents a point example select st point(binary('0x0101000000000000000000f03f0000000000000040')); output point(1 2) st point(char) creates a point from a char value that represents a point in wkt format syntax st point(char) argument data type description char char a char that represents a point in wkt format example select st point('point(1 2)'); output point(1 2) st point(lon, lat) creates a point defined with the values provided for the longitude and latitude coordinates syntax st point(lon, lat) argument data type description lon double a double value that represents a longitude coordinate lat double a double value that represents a latitude coordinate example select st point(87 6386, 41 8843); output point(87 6386 41 8843) st pointfromewkt alias for /#stpoint creates a point using an ewkt formatted char as an input argument syntax st pointfromewkt(srid char) argument data type description srid char char a string that includes an spatial reference identifier (srid) value and an ewkt formatted value that represents a point separate the values in the string by a semicolon using this format 'srid = value; point value' the input string must include the srid = value; component however, the database ignores this component as all {{ocient}} geography types are srid = 4326 example select st pointfromewkt('srid=4326;point(1 2)'); output point(1 2) st pointfromgeojson creates a point represented by the specified geojson value as an input argument a second optional boolean argument determines if the specified geojson should be converted from a planar to a geodesic representation if you specify a null value for either argument, the function returns null syntax st pointfromgeojson(geojson \[, geodesic ] ) argument data type description geo json string a string of a geojson valid geojson formats follow https //datatracker ietf org/doc/rfc7946/ , which you can generate using the docid\ uq rlzenk gtplkr2hyb5 function if you specify an invalid geojson, the behavior of the function is undefined the function returns null if any argument is null geodesic boolean optional if you set this argument to true , the specified geojson is converted from a planar to a geodesic representation this does not affect point geospatial objects the default value is false examples in this example, the function captures a point from an empty geojson representation select st pointfromgeojson('{"type" "point","coordinates" \[]}',false); output point empty in this example, the function captures a point from a geojson representation select st pointfromgeojson('{"type" "point","coordinates" \[1,1]}',false); output point(1 1) st pointfromgeohash creates a point represented by the specified geohash syntax st pointfromgeohash(geohash) argument data type description geohash string a string of a valid geohash valid geohashes contain only the characters 0123456789bcdefghjkmnpqrstuvwxyz if you specify an invalid geohash, the function throws an invalid argument error the function returns null if this argument is null examples select st pointfromgeohash('c0w3hf1s70w3hf1s70w3'); output point( 126 00000000000003 48 00000000000007) select st pointfromgeohash('kzn21'); output point(42 60498046875 5 60302734375) st pointfromtext alias for /#stpointchar st pointfromwkb alias for /#stpointbinary related links docid\ ogtviwl gtbgv0chhrh 3 docid\ uq rlzenk gtplkr2hyb5