SQL Reference
Geospatial Functions
the {{ocienthyperscaledatawarehouse}} has {{ocientgeo}} that supports three different geospatial geographies polygon , linestring , and point a polygon can be constructed with a closed linestring or an outer shell and array of inner rings a linestring represents a series of points connected by line segments it can be constructed with either linestring or point data types a point represents a point in space defined by an (x, y) or (longitude, latitude) coordinate pair each linestring or polygon value can be up to a maximum of 512 mb in size this means a linestring or polygon can contain approximately 32 million point values these supported geospatial data types require well known text (wkt) formatting for formatting examples, see data types docid\ g9 6amoszrxd9exdwggcz or wkt representation of geometry the ocientgeo functionality reference also contains examples with supported formatting and syntax each geospatial geography has a number of functions and operators that can be used in sql queries to perform analyses some functions apply to specific geography types for operators specific to geospatial data types, refer to geospatial functions docid 3g3himioouxfpawod0fi0 ocientgeo uses the authalic radius of the earth, 6371007 1810824 meters, as the reference for many measurement calculations the authalic radius reference might cause slight differences in measurements compared to other geospatial systems that use a different radius definition geospatial operators ocientgeo supports special operators that perform operations on two different geographies these can be used in queries to compare geographies or calculate values based on the geographies operator syntax purpose intersects geoa && geob returns true if the bounding box of geography a intersects with the bounding box of b contained geoa @ geob returns true if the bounding box of geography a is contained within the bounding box of b equal geoa = geob returns true if the bounding box of geography a is the same as bounding box of b contains geoa geob returns true if the bounding box of geography a contains the bounding box of b distance geoa < > geob returns the distance in meters between the two geography parameters bounding box distance geoa <#> geob returns the distance in meters between the bounding box of the two geography parameters centroid distance geoa << >> geob returns the distance in meters between the centroids of the two geography parameters geospatial functions overview ocientgeo supports many geospatial functions that operate on point, linestring, and polygon values each function, its expected inputs, and return type are described in the following section geospatial filtering queries that involve geospatial filtering can make use of functions in the spatial relationships docid\ cai7h lh9vyvdihc8nrh section to optimize these queries, ocientgeo provides a spatial index that you can apply to columns with geospatial data types for details about the spatial index, see secondary indexes docid\ pvmvtea poabqrd9q vkc attribute functions docid\ gat6uiiectf ysibhiv u attribute functions return descriptive information on the specified data set st coorddim st dimension st geometrytype st isempty st memsize st ndims st ndimension st npoints st numpoints st srid st x st xmax st xmin st y st ymax st ymin conversion functions docid\ xwqsjw7ilwis8jliqujvr conversion functions transform a specified operand to a different data type st asbinary st aswkb st asgeojson st asewkt st aslatlontext st astext st aswkt st geohash linestring constructors docid 23wnavad2bwc2enidb6wy linestring constructors use geospatial data to create a linestring object st linefromtext st linefromgeojson st linefromwkb st linefromewkt st linestring st makeline linestring functions docid\ wg zsriizjfn3xpyw13lp linestring functions can perform alterations or access descriptive information on linestring objects st addpoint st endpoint st lineinterpolatepoint st linelocatepoint st linesubstring st pointn st removepoint st setpoint st startpoint point constructors docid\ xcyhlciuwq ll4op5kfo point constructors use geospatial data to create a point object st centroid st geogpoint st makepoint st point st pointfromewkt st pointfromgeohash st pointfromgeojson st pointfromtext st pointfromwkb polygon constructors docid\ kh okeoguvnbioqtvv1ha polygon constructors use geospatial data to create a polygon object st forceccw st makepolygon st polygon st polygonfromgeojson st polygonfromwkb st polygonfromewkt st polygonfromtext st wholeearth spatial measurement docid\ wl 1wpoiuauejgdvofohc spatial measurement functions can perform basic calculations on geospatial data, such as measuring the distance between two point objects or the area of a polygon object st area st angle st azimuth st distance st distancesphere st distancespheroid st euclideandistance3d st hausdorffdistance st length st length2d st minimumdistancetosurface st maxdistance st perimeter st perimeter2d spatial operators docid\ k seycheuebhzs21kem6v spatial operators perform geometry calculations on geospatial data to return a different type of geospatial data st boundingdiagonal st buffer st closestpoint st convexhull st differencearray st envelope st expand st exteriorring st flipcoordinates st force2d st interiorringn st intersectall st intersectionarray st longestline st makeenvelope st minimumboundingcircle st multidifferencearray st multiintersectionarray st multisymdifferencearray st multiunionarray st nrings st numinteriorring st numinteriorrings st pointonsurface st project st reduceprecision st removerepeatedpoints st reverse st segmentize st shortestline st simplify st simplifyarray st snaptogrid st symdifferencearray st unionarray spatial relationships docid\ cai7h lh9vyvdihc8nrh spatial relationship functions use arguments to test for different types of spatial relationships st clusterdbscan st contains st containsproperly st covers st coveredby st crosses st disjoint st dwithin st equals st intersects st isccw st ispolygonccw st ispolygoncw st isclosed st isring st issimple st isvalid st overlaps st pointinsidecircle st relate st touches st within spatiotemporal measurement docid\ t5lzn2qtkihkqs7zjttxu spatiotemporal measurement functions can perform basic calculations on geospatial data paired with timestamp data st distance st maxdistance st totalsecondsinintersection spatiotemporal operators docid\ ujzu ikrvmucbv0el6kkn spatiotemporal operators perform calculations on geospatial data using an array of timestamp arguments st longestline st linegetalltimesatpoint st linegetpointattime st linegettimeatpoint st intersection st shortestline related videos at the whiteboard with ocient geospatial analytics