Geospatial Functions
The geospatial functions follow operations implemented using ESRI’s widely-used public domain geometry library of API functions (https://github.com/Esri/geometry-api-java/wiki). This topic describes each function.
Data Types and Arguments
Arguments and return values are transient objects that are internal to Graph Lakehouse. The values may contain arbitrarily long sequences of raw data bytes. These objects cannot be directly persisted to the graph store, however, a Custom object (return value of a function) can be bound to a variable (using a BIND expression) and can be passed to functions as arguments.
The life span of a Custom object handle cannot exceed one query. A Custom object has to be serialized into some form of text string or a URI of a user-defined data type to return as query results or save in the graph store.
Some functions include arguments labeled as x, y, and z. These arguments correspond to longitude (x), latitude (y), and height or altitude (z) values in standard geospatial coordinate systems. Coordinates that specify an x, y location in a Cartesian coordinate system or an x, y, z coordinate in a three dimensional system represent locations on the Earth’s surface relative to other locations. In addition to the Cartesian coordinate system, the Graph Lakehouse geospatial functions support other coordinate systems including Spherical, Cylindrical, and Elliptical.
Representations of function syntax included in this topic use braces ([arg]
) to represent optional arguments. In addition, the convention, arg1 [, ..., argN]
is used to indicate when you can include any number of arguments, 1 to N. Similarly, for functions that require an index argument, such as ST_PointN, the index values also range from 1 to N.
Geospatial functions use geometry inputs provided in the following forms:
- WKT String geometry
- WKTLiteral geometry
- GMLLiteral geometry
- Graph Lakehouse Custom geometry data type (wrapper encapsulation of the OGCGeometry standard data type from the ESRI library)
The Graph Lakehouse geospatial functions follow the standards below for reading and parsing particular geometry values:
- For GML readers and GML literal values, the functions support GML version 2.0 and use the CRS 84 coordinate system by default.
- The Shape (
.shp
) file reader supports version 1000.
- For WKT geometry parsing, the functions follow the WKT version 1 standard and use the 4326 coordinate system by default.
- The KML reader follows the version 2.2.0 standard.
Functions
The geospatial functions are grouped by the following categories:
- Point and Multipoint Functions: These functions operate on Point (a single location in space that has, at a minimum, an x-coordinate and y-coordinate) and MulitPoint (an ordered collection of points) shapes.
- LineString and MultiLineString Functions: These functions operate on LineString (a sequence of points with boundary endpoints) and MultiLineString (a collection of LineStrings) shapes.
- Polygon Functions: These functions operate on Polygons, MultiPolygons, Circle and Circle Arc Polygons, Ellipse and Elliptical Arc Polygons, Rectangle Polygons, and Squircle Polygons.
- Utility Functions: These functions are common to all shapes and provide
operations such as conversion, translation, or conditional testing.
- Aggregator (UDA) Functions: Aggregators construct new geometric shapes from multiple aggregated geometries.
- Services (UDS) Functions: The services extract geometric information from source files such as
.shp
, .gml
, .kml
, and .json
.
The URI for the geospatial functions is <http://www.opengis.net/def/function/geosparql/>
. For readability, the syntax for each function below includes the prefix geof:
, defined as PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
.
Point and Multipoint Functions
- ST_Point: Constructs a Point from a given set of x, y, z, and m coordinates.
- ST_X: Returns the X coordinate of a Point.
- ST_SetX: Sets the X coordinate of a Point.
- ST_Y: Returns the Y coordinate of a Point.
- ST_SetY: Sets the Y coordinate of a Point.
- ST_Z: Returns the Z coordinate of a Point.
- ST_SetZ: Sets the Z coordinate of a Point.
- ST_M: Returns the M coordinate of a Point.
- ST_SetM: Sets the M coordinate of a Point.
- ST_Bin: Returns the bin ID of a Point.
- ST_BinEnvelope: Returns the bin envelope for a Point or bin ID.
- ST_MultiPoint: Constructs a MultiPoint geometry from a set of x and y coordinate pairs.
- ST_PointN: Returns a Point that is at the Nth index position in a MultiPoint.
- ST_GeomFromText: Constructs a Point from a given set of well known text (WKT) coordinates.
- ST_GeomFromWKB: Constructs a Point from a given set of well known binary (WKB) coordinates.
ST_Point
This function returns a Point as a custom object constructed from a given set of x, y, z, and m coordinates. You can specify two coordinates (x and y), three coordinates (x, y, and z), or four coordinates (x, y, z, and m).
Syntax
geof:ST_Point(x, y [, z ] [, m ])
x
|
double |
The X coordinate of the point. |
y
|
double |
The Y coordinate of the point. |
z
|
double |
The optional Z coordinate of the point. |
m
|
double |
The optional M coordinate of the point. |
Returns
Example
SELECT (geof:ST_AsText(geof:ST_SetM(geof:ST_Point(1,2,3),4)) as ?point)
ST_X
This function returns the X coordinate of a Point geometry.
Syntax
geof:ST_X(geom)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (MIN(?point_x) as ?3d_min)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
BIND(geof:ST_X(?point_2d) as ?point_x)
BIND(geof:ST_Y(?point_2d) as ?point_y)
}
ST_SetX
This function sets the X coordinate of a Point geometry.
Syntax
geof:ST_SetX(geom, x)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
x
|
double |
The X coordinate point value to set. |
Returns
Custom object |
The X coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geo:ST_SetX(geo:ST_Point(1,2),4)) as ?point)
ST_Y
This function returns the Y coordinate of a Point geometry.
Syntax
geof:ST_Y(geom)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (MIN(?point_x) as ?3d_min)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
BIND(geof:ST_X(?point_2d) as ?point_x)
BIND(geof:ST_Y(?point_2d) as ?point_y)
}
ST_SetY
This function sets the Y coordinate of a Point geometry.
Syntax
geof:ST_SetY(geom, y)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
y
|
double |
The Y coordinate point value to set. |
Returns
Custom object |
The Y coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (MIN(?point_y) as ?3d_min)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
BIND(geof:ST_X(?point_2d) as ?point_x)
BIND(geof:ST_Y(?point_2d) as ?point_y)
}
ST_Z
This function returns the Z coordinate of a Point geometry.
Syntax
geof:ST_Z(geom)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (MAX(geof:ST_Z(geof:ST_Point(?point_x, ?point_y, ?point_z))) as ?3d_max)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
BIND(geof:ST_X(?point_2d) as ?point_x)
BIND(geof:ST_Y(?point_2d) as ?point_y)
BIND(32 as ?point_z)
}
ST_SetZ
This function sets the Z coordinate of a Point geometry.
Syntax
geof:ST_SetZ(geom, z)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
z
|
double |
The Z coordinate point value to set. |
Returns
Custom object |
The Z coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_SetZ(geof:ST_Point(1,2),4)) as ?point_with_z_coordinate)
ST_M
This function returns the M coordinate of a Point geometry.
Syntax
geof:ST_M(geom)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (MIN(geof:ST_M(geof:ST_Point(?point_x, ?point_y, ?point_z, ?point_m))) as ?result)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
BIND(geof:ST_X(?point_2d) as ?point_x)
BIND(geof:ST_Y(?point_2d) as ?point_y)
BIND(25 as ?point_z)
BIND(30 as ?point_m)
}
ST_SetM
This function sets the M coordinate of a Point geometry.
Syntax
geof:ST_SetM(geom, m)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
m
|
double |
The M coordinate point value to set. |
Returns
Custom object |
The M coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_SetM(geof:ST_Point(1,2,3),4)) as ?point)
ST_Bin
This function returns the bin ID of a Point geometry.
Syntax
geof:ST_Bin(binSize, geom)
binSize
|
double |
The bin size. |
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT (geof:ST_Bin(10, ?point_2d) as ?union)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
<http://csi.com/geologic_units_24k/id> "0"^^xsd:long.
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
}
ST_BinEnvelope
This function returns the bin envelope for a Point geometry or bin ID. You can also return the bin envelope for multiple Points.
Syntax
geof:ST_BinEnvelope(binSize, geom)
binSize
|
double |
The bin size. |
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
The bin envelope. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT (geof:ST_AsText(geof:ST_BinEnvelope(10.0, ?point_2d)) as ?union)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
<http://csi.com/geologic_units_24k/id> "0"^^xsd:long.
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
}
ST_MultiPoint
This function returns a MultiPoint as a custom object constructed from a set of X and Y coordinate pairs. You can specify any number of X and Y coordinates.
Syntax
geof:ST_MultiPoint(x, y [, xx ] [, yy ])
x
|
double |
The X coordinate value. |
y
|
double |
The Y coordinate value. |
xx
|
double |
Optional X coordinate values. |
yy
|
double |
Optional Y coordinate values. |
Returns
Custom object |
The multipoint. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_MultiPoint(?x,?y,?x1,?y1,?x2,?y2)) as ?multipoint_pairs)
WHERE {
values (?x ?y ?x1 ?y1 ?x2 ?y2) {(1.1 7.0 2 3 5 -6.7) (-2 3.4 -7.8 9.3 5.4 -1.0)}
}
ST_PointN
This function returns the Point that is at the Nth index in a MultiPoint.
Syntax
geof:ST_PointN(geom, index)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
index
|
int |
The index of the point to retrieve from the specified geometry. |
Returns
Custom object |
The point at the Nth index. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_PointN(geof:ST_GeomFromText(?x) , 2)) as ?envelope)
WHERE {
VALUES (?x) {
('MULTILINESTRING M((10 10 10, 20 20 20, 10 40 30),(40 40 20, 30 30 30, 40 20 10, 30 10 20))')
('MULTILINESTRING M((10 10 20, 20 20 30, -10 -40 -30),(10 40 20, 30 30 30, 10 20 10, 30 10 20))')
}
}
ST_GeomFromText
This function returns a Point as a custom object constructed from a set of well known free text (WKT) coordinates.
Syntax
geof:ST_GeomFromText(wkt [, SRID ] )
wkt
|
string |
Input geometry in WKT string format. The geometry shape value can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon. |
SRID
|
int |
Optional well known reference ID. If not specified, the default SRID is 0. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_MultiLineString(geof:ST_GeomFromText(?l1),geof:ST_GeomFromText(?l2))) as ?MultiLineString)
WHERE {
VALUES (?l1 ?l2) {
('LINESTRING (8 7, 7 8)' 'LINESTRING (1 7, 7 8)')
('LINESTRING (18 17, -17 8)' 'LINESTRING (-1 7, 7 -8)')
}
}
ST_GeomFromWKB
This function returns a Point as a custom object constructed from a set of well known binary (WKB) coordinates.
Syntax
geof:ST_GeomFromWKB(wkb_hexstr [, wkid ] )
wkb_hexstr
|
string |
Input geometry in WKB Hex String format. The geometry shape value can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon. |
wkid
|
int |
Optional well known reference ID. If not specified, the default is 0. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_GeomFromWKB(?val)) as ?geom)
WHERE {
VALUES (?val) {('000000000140000000000000004010000000000000')}
}
LineString and MultiLineString Functions
- ST_LineString: Constructs a LineString from a number of Points in an array.
- ST_StartPoint: Returns the start point of a line.
- ST_EndPoint: Returns the end point of a line.
- ST_IsClosed: Determines whether a line geometry is a ring.
- ST_IsRing: Determines whether a geometry is closed.
- ST_MultiLineString: Returns a MultiLine geometry constructed from a list of Line geometries.
ST_LineString
This function returns a LineString as a custom object constructed from a number of Points. Any number of Point geometries can be specified to form a new line.
Syntax
geof:ST_LineString(point1 [, ..., pointN])
point1–N
|
Object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
The LineString. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_LineString(geof:ST_GeomFromText(?pt1),geof:ST_GeomFromText(?pt2))) as ?line_from_points)
WHERE {
VALUES (?pt1 ?pt2) {
('Point(1 1)' 'Point(-1 -2)') ('Point Z(-11 1 4)' 'Point ZM(0 9.2 -1 -2)')
}
}
ST_StartPoint
This function returns the start point of a given line.
Syntax
geof:ST_StartPoint(line)
line
|
Object |
LineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
The start point of the line. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsGeoJSON(geof:ST_StartPoint(geof:ST_GeomFromText(?line_str_wkt))) as ?start_point) (geof:ST_AsGeoJSON(geof:ST_EndPoint(geof:ST_GeomFromText(?line_str_wkt))) as ?end_point)
FROM <linestring>
WHERE {
?ln_str_ins a <http://csi.com/road_centerline/linestring>;
<http://csi.com/road_centerline/shape> ?line_str_wkt;
<http://csi.com/road_centerline/no_of_points> ?no_pt_ln.
}
ORDER BY desc(?no_pt_ln) desc(?line_str_wkt)
LIMIT 1
ST_EndPoint
This function returns the end point of a given line.
Syntax
geof:ST_EndPoint(line)
line
|
Object |
LineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
The end point of the line. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsGeoJSON(geof:ST_StartPoint(geof:ST_GeomFromText(?line_str_wkt))) as ?start_point)
(geof:ST_AsGeoJSON(geof:ST_EndPoint(geof:ST_GeomFromText(?line_str_wkt))) as ?end_point)
FROM <linestring>
WHERE {
?ln_str_ins a <http://csi.com/road_centerline/linestring>;
<http://csi.com/road_centerline/shape> ?line_str_wkt;
<http://csi.com/road_centerline/no_of_points> ?no_pt_ln.
}
ORDER BY desc(?no_pt_ln) desc(?line_str_wkt)
LIMIT 1
ST_IsClosed
This function evaluates whether a geometry is closed.
Syntax
geof:ST_IsClosed(line)
line
|
Object |
LineString or MultiLineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
boolean |
True if the geometry is closed. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_IsClosed(geof:ST_GeomFromText(?x)) as ?ring)
WHERE {
VALUES (?x) {
('LINESTRING (30 10, 10 10, 40 40, 30 10)')('LINESTRING Z(-30.56 12 45, 10 1 -5, -67 -0.56 68, -30.56 12 45)')
}
}
ST_IsRing
This function evaluates whether a Line geometry is a ring.
Syntax
geof:ST_IsRing(line)
line
|
Object |
LineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
boolean |
True if the line is a ring. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_IsRing(geof:ST_GeomFromText(?x,0)) as ?ring_simple)
WHERE {
VALUES (?x) {
('LINESTRING (0 0, 1 1, 1 2, 2 1, 1 1, 0 0)')
('LINESTRING (0 0, 3 4)')
}
}
ST_MultiLineString
This function returns the MultiLine geometry constructed from a list of Line geometries. Any number of line geometries can be specified to form a new MultiLine.
Syntax
geof:ST_MultiLineString(line1 [, ..., lineN])
line1–N
|
Object |
LineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
The multiline geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_MultiLineString(geof:ST_GeomFromText(?l1),geof:ST_GeomFromText(?l2))) as ?MultiLineString)
WHERE {
VALUES (?l1 ?l2) {
('LINESTRING (8 7, 7 8)' 'LINESTRING (1 7, 7 8)')
('LINESTRING (18 17, -17 8)' 'LINESTRING (-1 7, 7 -8)')
}
}
Polygon Functions
- ST_Polygon: Returns a Polygon constructed from multiple Point geometries.
- ST_ExteriorRing: Returns the exterior ring of a Polygon.
- ST_NumInteriorRing: Returns the number of interior rings that exist in a Polygon.
- ST_InteriorRingN: Returns the interior ring at the Nth index position in a Polygon.
- ST_MultiPolygon: Returns a MultiPolygon constructed from a list of Polygons.
- ST_Circle: Returns a Circle Polygon from a radius and x, y, and z coordinates.
- ST_CircleArc: Returns a Circle Arc Polygon from a radius and Point geometry.
- ST_Arc: Returns an Arc line from a start angle and size angle.
- ST_Ellipse: Returns an Ellipse Polygon from a radius and Point.
- ST_EllipticalArc: Returns an Elliptical Arc Polygon from a radius and Point.
- ST_Rectangle: Returns a Rectangle Polygon from a height, width, and Point.
- ST_Squircle: Returns a Squircle Polygon from a radius and Point.
- ST_GeomFromGML: Returns geometry based on a GML specification.
ST_Polygon
This function returns Polygon geometry constructed from multiple Point geometries.
Syntax
geof:ST_Polygon(point1 [, ..., pointN])
point1–N
|
Object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. Any number of point geometries can be passed as input to form a new polygon but all points should have the same dimensions. That is, the specified input geometries should all be either 2D point geometries or 3D point geometries. |
Returns
Custom object |
The polygon. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Polygon(geof:ST_Point(?x,?y),geof:ST_Point(?x1,?y1),
geof:ST_Point(?x2,?y2))) as ?line_from_points)
WHERE {
VALUES (?x ?y ?x1 ?y1 ?x2 ?y2) {
(1.1 7.0 2 3 5 -6.7)
(-2 3.4 -7.8 9.3 5.4 -1.0)
}
}
ST_ExteriorRing
This function returns the exterior ring of a given Polygon geometry.
Syntax
geof:ST_ExteriorRing(polygon)
polygon
|
Object |
Polygon geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
The exterior ring. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_ExteriorRing('POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')) as ?exterior_ring)
ST_NumInteriorRing
This function returns the number of interior rings that exist in a given Polygon.
Syntax
geof:ST_NumInteriorRing(polygon)
polygon
|
Object |
Polygon geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
int |
The number of interior rings. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT (geof:ST_NumInteriorRing(geof:ST_GeomFromText(?multi_pt_wkt)) as ?polygon)
FROM <polygon>
WHERE {
?multi_pt a <http://csi.com/national_weather_service_wind_gust_forecast/polygon>;
<http://csi.com/national_weather_service_wind_gust_forecast/shape> ?multi_pt_wkt;
<http://csi.com/national_weather_service_wind_gust_forecast/id> "0"^^xsd:int.
}
ST_InteriorRingN
This function returns the interior ring at the Nth index position in a Polygon.
Syntax
geof:ST_InteriorRingN(polygon, n)
polygon
|
Object |
Polygon geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
n
|
int |
The index of the interior ring to retrieve from the specified polygon. |
Returns
Custom object |
The interior ring. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_InteriorRingN(geof:ST_GeomFromText(?x),1)) as ?interiorRing)
WHERE {
VALUES (?x) {
('POLYGON((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))')
('POLYGON((2 2, 6 4, 6 10, -2 10, -2 4, 2 2),(1 5, 3 5, 3 7, 1 7))')
}
}
ST_MultiPolygon
This function returns MultiPolygon constructed from a list of Polygons. Any number of Polygon geometries can be specified as input.
Syntax
geof:ST_MultiPolygon(polygon1 [, ..., polygonN])
polygon1–N
|
Object |
Polygon geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
The multipolygon. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_MultiPolygon(geof:ST_GeomFromText(?p1),geof:ST_GeomFromText(?p2))) as ?agg_multipolygon)
WHERE {
VALUES (?p1 ?p2) {
('POLYGON ((2 0, 2 3, 3 0))' 'POLYGON ((11 12,-11 -12,11 -12))')
('POLYGON ((1 2,-2 -3,9.2 -4.5))' 'POLYGON ((-1 -2, -4.5 -17, -5.6 -78))')
}
}
ST_Circle
This function returns a Circle Polygon from a given radius and Point.
Syntax
geof:ST_Circle(geom, radius, numOfPoints)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
radius
|
double |
The radius of the circle polygon. |
numOfPoints
|
int |
The number of points to use to represent the new circle polygon. |
Returns
Custom object |
The circle polygon. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Circle((geof:ST_Point(1,2)),3,10)) as ?circle_polygon)
ST_CircleArc
This function returns a Circular Arc Polygon from the given radius parameters and Point arguments.
Syntax
geof:ST_CircleArc(geom, startRad, sizeRad, radius, numOfPoints)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
startRad
|
double |
The start angle in radians. |
sizeRad
|
double |
The size of the angle in radians. |
radius
|
double |
The radius of the circular arc polygon. |
numOfPoints
|
int |
The number of points to use to represent the new polygon. |
Returns
Custom object |
The circular arc polygon. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_CircleArc((geof:ST_Point(1,2)),5,10,3,10)) as ?circle_arc_polygon)
ST_Arc
This function returns an Arc given a center point, radius, start and size angle, and number of Points arguments.
Syntax
geof:ST_Arc(x, y, radius, startRad, sizeRad, numOfPoints)
x
|
double |
The X coordinate of the center used to draw the arc. |
y
|
double |
The Y coordinate of the center used to draw the arc. |
radius
|
double |
The radius of the arc. |
startRad
|
double |
The start angle in radians. |
sizeRad
|
double |
The size of the angle in radians. |
numOfPoints
|
int |
The number of points to use to represent the new arc. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Arc(1,2,5,10,20,4)) as ?Arc)
ST_Ellipse
This function returns an Ellipse Polygon based on a given radius and Point geometry.
Syntax
geof:ST_Ellipse(geom, xRadius, yRadius, numOfPoints)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
xRaduis
|
double |
The X radius for the ellipse polygon. |
yRadius
|
double |
The Y radius for the ellipse polygon. |
numOfPoints
|
int |
The number of points to use to represent the new ellipse polygon. |
Returns
Custom object |
The ellipse polygon. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Ellipse((geof:ST_Point(1,2)),2,3,10)) as ?ellipse_polygon)
ST_EllipticalArc
This function returns an Elliptical Arc Polygon from the given radius and Point geometry.
Syntax
geof:ST_EllipseArc(geom, startRad, sizeRad, width, height, numOfPoints)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
startRad
|
double |
The start angle in radians. |
sizeRad
|
double |
The size of the angle in radians. |
width
|
double |
The width of the elliptical arc. |
height
|
double |
The height of the elliptical arc. |
numOfPoints
|
int |
The number of points to use to represent the new elliptical arc polygon. |
Returns
Custom object |
The elliptical arc polygon. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_EllipticalArc((geof:ST_Point(1,2)),5,10,3,10,10)) as ?elliptical_arc_polygon)
ST_Rectangle
This function returns a Rectangle Polygon from a given height, width, and Point geometry.
Syntax
geof:ST_Rectangle(geom, width, height, numOfPoints)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
width
|
double |
The width of the rectangle. |
height
|
double |
The height of the rectangle. |
numOfPoints
|
int |
The number of points to use to represent the new rectangle polygon. |
Returns
Custom object |
The rectangle polygon. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Rectangle((geof:ST_Point(1,2)),3,2,10)) as ?rectangle_polygon)
ST_Squircle
This function returns a Squircle Polygon from a given radius and Point geometry.
Syntax
geof:ST_Squircle(geom, radius, numOfPoints)
geom
|
object |
Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
raduis
|
double |
The radius of the squircle polygon. |
numOfPoints
|
int |
The number of points to use to represent the new squircle polygon. |
Returns
Custom object |
The squircle polygon. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Squircle((geof:ST_Point(1,2)),3,10)) as ?squircle_polygon)
ST_GeomFromGML
This function returns geometry based on a GML specification.
Syntax
geof:ST_GeomFromGML(gml)
gml
|
string |
Input geometry in GMLLiteral format. The geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon. |
Returns
Custom object |
The geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_GeomFromGML(geof:ST_AsGML(geof:ST_GeomFromText('POINT(1 2)')))) as ?geometryGml)
Utility Functions
- ST_MinX: Returns the minimum value of the X coordinate for a geometry.
- ST_MaxX:
Returns the maximum value of the X coordinate for a geometry.
- ST_MinY:
Returns the minimum value of the Y coordinate for a geometry.
- ST_MaxY: Returns the maximum value of the Y coordinate for a geometry.
- ST_MinZ: Returns the minimum value of Z coordinate for a geometry.
- ST_MaxZ: Returns the maximum value of Z coordinate for a geometry.
- ST_MinM: Returns the minimum measure value for a geometry.
- ST_MaxM: Returns the maximum measure value for a geometry.
Serialization
- ST_AsGeoJSON: Returns a GeoJSON representation of a shape.
- ST_AsJSON: Returns a JSON representation of a shape.
- ST_AsBinary: Returns a binary object from a geometry.
- ST_AsText: Returns a well known text (WKT) representation of a shape.
- ST_AsGML: Returns geometry from a GML representation of a shape.
- ST_AsWktLiteral: Returns a URL from WKT representation of a geometry.
- ST_AsGmlLiteral: Returns a URL from GML representation of a geometry.
- ST_AsWKB_HEX: Returns a hex string from WKB representation of a geometry.
Logical, Comparison, and Relational Operations
- ST_Is3D: Determines if a geometry object is three-dimensional.
- ST_IsEmpty: Determines if a geometry object is empty.
- ST_IsMeasured: Determines if a geometry object is measured.
- ST_IsSimple: Determines if a geometry object is simple.
- ST_Crosses: Determines if geometry1 crosses geometry2.
- ST_Contains: Determines if geometry1 contains geometry2.
- ST_Disjoint: Determines if geometry1 has any Points in common with geometry2.
- ST_Equals: Determines if geometry1 equals geometry2.
- ST_Intersects: Determines if geometry1 intersects geometry2.
- ST_Overlaps: Determines if geometry1 overlaps geometry2.
- ST_Touches: Determines if geometry1 touches geometry2.
- ST_Within: Determines if geometry1 is within geometry2.
- ST_EnvIntersects: Determines if the envelopes of geometry1 and geometry2 intersect.
- ST_Relate: Determines if geometry1 has the specified DE-9IM relationship with geometry2.
Conversion, Calculation, and Translation
- ST_Distance: Returns the distance between two geometry objects.
- ST_Boundary: Returns the boundary of a given geometry.
- ST_Intersection: Returns the intersection of two geometry objects.
- ST_Difference: Returns the difference between two geometry objects.
- ST_SymDifference: Returns the symmetric difference between two geometry objects.
- ST_SRID: Returns the spatial reference ID of a geometry.
- ST_SetSRID: Sets the spatial reference ID of a geometry and returns its coordinates.
- ST_Dimension: Returns the spatial dimension of a geometry.
- ST_Length: Returns the length of a Line.
- ST_Area: Returns the area of a Polygon or MultiPolygon.
- ST_CoordDim: Returns the count of coordinate components.
- ST_Envelope: Returns the envelope of a geometry.
- ST_GeometryType: Returns the geometry type of a geometry.
- ST_Union: Returns the union of one or more geometries.
- ST_NumPoints: Returns the number of Points in a geometry.
- ST_NumGeometries: Returns the number of geometries in a multi-geometry shape.
- ST_GeometryN: Returns the Nth geometry in a multi-geometry shape.
- ST_Centroid: Returns the centroid of a geometry.
- ST_Buffer: Returns the geometry buffered by distance.
- ST_ConvexHull: Returns the convex hull of one or more geometries.
- ST_GeodesicLengthWGS84: Returns the distance (in meters) along a Line of a WGS84 spheroid for geographic coordinates.
- ST_GeomFromJSON: Returns the geometry from a JSON representation of a shape.
- ST_GeomFromGeoJSON: Returns the geometry from a GeoJSON representation of a shape.
- ST_LatLonFromDMSToDD: Returns latitude and longitude in decimal degrees.
- ST_GeomFromWktLiteral: Returns geometry object from a WKT representation of a shape.
- ST_GeomFromGmlLiteral: Returns geometry object from a GML representation of a shape.
- ST_ConvertCoordinates: Return coordinates converted from one coordinate system to another.
- ST_IsValidWKT: Validates whether a given WKT representation is correct.
- ST_IsValidGeoJSON:
Validates whether a given geoJSON representation is correct.
- ST_Translate: Transforms a geometry with given shift values.
- ST_Scale: Scales a geometry to a new size using scale factor arguments.
- ST_Shear: Shears a geometry around an axis using shearing arguments.
- ST_Rotate: Rotates geometry around the origin using rotation arguments.
ST_MinX
This function returns the minimum value of the X coordinate for a geometry.
Syntax
geof:ST_MinX(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The minimum value of the X coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_MinX(?z1) as ?minX)
WHERE {
SELECT (geof:ST_Point(?x, ?y, ?z, ?m) as ?z1)
WHERE {
VALUES (?x ?y ?z ?m) {
(1.1 2.2 3.2 1) (1.2 3.1 1.1 2) (8.2 3.2 9.2 3)
}
}
}
ST_MaxX
This function returns the maximum value of the X coordinate for a geometry.
Syntax
geof:ST_MaxX(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The maximum value of the X coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT ?no_pt_ln ?xmin ?xmax ?ymin ?ymax
FROM <multipoint>
WHERE {
?ln_str_ins a <http://csi.com/wind_speed_at_block_group_level/multipoint>;
<http://csi.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
<http://csi.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
BIND(geof:ST_GeomFromText(?multi_pt_wkt) as ?geo_shp)
BIND(geof:ST_MinX(?geo_shp) as ?xmin)
BIND(geof:ST_MaxX(?geo_shp) as ?xmax)
BIND(geof:ST_MinY(?geo_shp) as ?ymin)
BIND(geof:ST_MaxY(?geo_shp) as ?ymax)
}
ORDER BY desc(?no_pt_ln)
LIMIT 1
ST_MinY
This function returns the minimum value of the Y coordinate for a geometry.
Syntax
geof:ST_MinY(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The minimum value of the Y coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT ?no_pt_ln ?xmin ?xmax ?ymin ?ymax
FROM <multipoint>
WHERE {
?ln_str_ins a <http://csi.com/wind_speed_at_block_group_level/multipoint>;
<http://csi.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
<http://csi.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
BIND(geof:ST_GeomFromText(?multi_pt_wkt) as ?geo_shp)
BIND(geof:ST_MinX(?geo_shp) as ?xmin)
BIND(geof:ST_MaxX(?geo_shp) as ?xmax)
BIND(geof:ST_MinY(?geo_shp) as ?ymin)
BIND(geof:ST_MaxY(?geo_shp) as ?ymax)
}
ORDER BY desc(?no_pt_ln)
LIMIT 1
ST_MaxY
This function returns the maximum value of the Y coordinate for a geometry.
Syntax
geof:ST_MaxY(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The maximum value of the Y coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT ?no_pt_ln ?xmin ?xmax ?ymin ?ymax
FROM <multipoint>
WHERE {
?ln_str_ins a <http://csi.com/wind_speed_at_block_group_level/multipoint>;
<http://csi.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
<http://csi.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
BIND(geof:ST_GeomFromText(?multi_pt_wkt) as ?geo_shp)
BIND(geof:ST_MinX(?geo_shp) as ?xmin)
BIND(geof:ST_MaxX(?geo_shp) as ?xmax)
BIND(geof:ST_MinY(?geo_shp) as ?ymin)
BIND(geof:ST_MaxY(?geo_shp) as ?ymax)
}
ORDER BY desc(?no_pt_ln)
LIMIT 1
ST_MinZ
This function returns the minimum value of the Z coordinate for a geometry.
Syntax
geof:ST_MinZ(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The minimum value of the Z coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_MinZ(geof:ST_GeomFromText("LINESTRING Z(10 12 1, 22 20 2, 1 40 3)")) as ?minZ)
ST_MaxZ
This function returns the maximum value of the Z coordinate for a geometry.
Syntax
geof:ST_MaxZ(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The maximum value of the Z coordinate. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_MaxZ(geof:ST_GeomFromText("LINESTRING Z(10 12 1, 22 20 2, 1 40 3)")) as ?maxZ)
ST_MinM
This function returns the minimum value of measure for a geometry.
Syntax
geof:ST_MinM(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The minimum value of measure. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_MinM(geof:ST_GeomFromText("LINESTRING ZM(10 12 1 2.1, 22 20 2 1.2, 1 40 3 4.3)")) as ?maxZ)
ST_MaxM
This function returns the maximum value of measure for a geometry.
Syntax
geof:ST_MaxM(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The maximum value of measure. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_MaxM(geof:ST_GeomFromText("LINESTRING ZM(10 12 1 2.1, 22 20 2 1.2, 1 40 3 4.3)")) as ?maxZ)
ST_AsGeoJSON
This function returns a GeoJSON representation of a geometric shape.
Syntax
geof:ST_AsGeoJSON(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
string |
The GeoJSON representation of the shape. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_IsValidGeoJSON(geof:ST_AsGeoJSON(geof:ST_GeomFromText('LINESTRING(4 6,7 10)'))) as ?is_valid_geojson)
ST_AsJSON
This function returns a JSON representation of a geometric shape.
Syntax
geof:ST_AsJSON(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
string |
The JSON representation of the shape. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_GeomFromJSON(geof:ST_AsJSON(geof:ST_GeomFromText(?x)))) as ?line_from_json)
WHERE {
VALUES (?x) {
('LINESTRING (0 0, 2 2)') ('LINESTRING Z(8 -7 -1, -7 -1 8)')
}
}
ST_AsBinary
This function returns a binary object from a given geometry.
Syntax
geof:ST_AsBinary(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The binary object. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsBinary(geof:ST_GeomFromText(?x)) as ?binary)
WHERE {
VALUES (?x) {
('GeometryCollection(Point(1 1),LineString(2 2, 3 3),Point(4 0))')
}
}
ST_AsText
This function returns the well known text (WKT) representation of a geometric shape.
Syntax
geof:ST_AsText(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
string |
The WKT representation of the shape. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Circle((geo:ST_Point(1,2)),3,10)) as ?circle_polygon)
ST_AsGML
This function returns geometry from the GML representation of a shape.
Syntax
geof:ST_AsGML(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsGML(geof:ST_Point(1.1,-6.7)) as ?point)
ST_AsWktLiteral
This function returns a URI from a well known text (WKT) representation of a shape.
Syntax
geof:ST_AsWktLiteral(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The WKT URI representation of the shape. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:sfContains(?x,geof:ST_AsWktLiteral(geof:ST_GeomFromText(?y))) as ?url)
WHERE {
VALUES (?x ?y) {
('<http://www.opengis.net/def/crs/OGC/1.3/CRS84>POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
('<http://www.opengis.net/def/crs/OGC/1.3/CRS84>POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (1 2)')
}
}
ST_AsGmlLiteral
This function returns a URI from the GML representation of a shape.
Syntax
geof:ST_AsGmlLiteral(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The GmlLiteral URI representation of the shape. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
SELECT (geof:sfContains(?x,geof:ST_AsGmlLiteral(?y)) as ?url)
WHERE {
VALUES (?x ?y) {
('<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 1 4, 4 4, 4 1))' '<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral)
('<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 1 4, 4 4, 4 1))' '<http://www.opengis.net/def/crs/EPSG/0/4326>Point (1 2)'^^geo:wktLiteral)
}
}
ST_AsWKB_HEX
This function returns a hex string from the WKB representation of a geometry.
Syntax
geof:ST_AsWKB_HEX(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsWKB_HEX(geof:ST_GeomFromText(?x)) as ?hex)
WHERE {
VALUES (?x) {
('POLYGON ((2 0, 2 1, 3 1))')
}
}
ST_Is3D
This function evaluates whether the specified geometry object is three-dimensional.
Syntax
geof:ST_Is3D(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the geometry is 3D. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Is3D(geof:ST_Point(?x,?y,?z)) as ?is3DGeometry)
WHERE {
VALUES (?x ?y ?z) {
(1.1 2.2 3.2) (1.2 3.1 -1.1) (-0.6 8.2 3.2)
}
}
ST_IsEmpty
This function evaluates whether the specified geometry object is empty.
Syntax
geof:ST_IsEmpty(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the geometry is empty. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_IsEmpty(geof:ST_GeomFromText(?x)) as ?empty)
WHERE {
VALUES (?x) {('point empty')}
}
ST_IsMeasured
This function evaluates whether a given geometry object is measured.
Syntax
geof:ST_IsMeasured(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the geometry is measured. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_IsMeasured(geof:ST_Point(?x,?y,?z,?m)) as ?measured)
WHERE {
VALUES (?x ?y ?z ?m) {
(1.1 2.2 3.2 3)
(1.2 3.1 -1.1 1)
(2 -0.6 8.2 3.2)
}
}
ST_IsSimple
This function evaluates whether a given geometry object is simple.
Syntax
geof:ST_IsSimple(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the geometry is simple. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_IsSimple(geof:ST_Point(?x, ?y)) as ?simple)
WHERE {
VALUES (?x ?y) {
(2 3)
(-1000 -234234)
}
}
ST_Crosses
This function evaluates whether geometry1 crosses geometry2.
Syntax
geof:ST_Crosses(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the first geometry crosses the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Crosses(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?crosses)
WHERE {
VALUES (?x ?y) {('LINESTRING (0 0, 1 1)' 'LINESTRING (1 0, 0 1)')
('LINESTRING (0 2, 0 1)' 'LINESTRING (2 0, 1 0)')}
}
ST_Contains
This function evaluates whether geometry1 contains geometry2.
Syntax
geof:ST_Contains(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the first geometry contains the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Contains(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?contains)
WHERE {
VALUES (?x ?y) {('POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))' 'Point (-106.4453583 39.11775)')
('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (2 3)')
('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (7 8)')}
}
ST_Disjoint
This function evaluates whether geometry1 is disjoint with geometry2, i.e., whether geometry1 has any points in common with geometry2.
Syntax
geof:ST_Disjoint(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the first geometry is disjoint with the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Disjoint(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?disjoint)
WHERE {
VALUES (?x ?y) {
('LINESTRING (0 0, 0 1)' 'LINESTRING (1 1, 1 0)')
('LINESTRING (0 0, 0 1)' 'LINESTRING (1 0, 0 1)')
}
}
ST_Equals
This function evaluates whether geometry1 equals geometry2.
Syntax
geof:ST_Equals(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the first geometry equals the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Equals(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?equals)
WHERE {
VALUES (?x ?y) {
('LINESTRING (0 0, 1 1)' 'LINESTRING (1 1, 0 0)')
('LINESTRING (0 0, 0 1)' 'LINESTRING (1 0, 0 1)')
}
}
ST_Intersects
This function determines if geometry1 intersects geometry2.
Syntax
geof:ST_Intersects(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the first geometry intersects the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Intersects(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?intersects)
WHERE {
VALUES (?x ?y) {
('LINESTRING (8 7, 7 8)' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
('LINESTRING (2 0, 2 3)' 'POLYGON ((1 1, 4 1, 4 4, 1 4))')
}
}
ST_Overlaps
This function evaluates whether geometry1 overlaps geometry2.
Syntax
geof:ST_Overlaps(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the first geometry overlaps the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Overlaps(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?overlaps)
WHERE {
VALUES (?x ?y) {
('POLYGON ((2 0, 2 1, 1 3))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
('POLYGON ((2 0, 2 1, 3 1))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((2 0, 2 3, 3 0))')
}
}
ST_Touches
This function evaluates whether geometry1 touches geometry2, i.e., whether they have any points in common.
Syntax
geof:ST_Touches(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the first geometry touches the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Touches(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?touches)
WHERE {
VALUES (?x ?y) {
('POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))' 'Point (-106.4453583 39.11775)')
('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (1 2)')
('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (7 8)')
}
}
ST_Within
This function evaluates whether geometry1 is within geometry2.
Syntax
geof:ST_Within(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the first geometry is within the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Within(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?is_point_within_polygon)
WHERE {
VALUES (?x ?y) {
('Point (-106.4453583 39.11775)' 'POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))')
('Point (2 3)' 'POLYGON ((1 1, 1 4, 4 4, 4 1))' )
('Point (7 8)' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
}
}
ST_EnvIntersects
This function evaluates whether the envelopes of geometry1 and geometry2 intersect.
Syntax
geof:ST_EnvIntersects(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the envelopes of geometry1 and geometry2 intersect. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_EnvIntersects(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?env_intersects)
WHERE {
VALUES (?x ?y) {
('LINESTRING (0 0, 1 1)' 'LINESTRING (1 3, 2 2)')
('LINESTRING (0 0, 2 2)' 'LINESTRING (1 0, 3 2)')
}
}
ST_Relate
This function evaluates whether geometry1 has the specified DE-9IM relationship with geometry2.
Syntax
geof:ST_Relate(geom1, geom2, "pattern_matrix")
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
pattern_matrix
|
string |
Represents a DE-9IM intersection pattern consisting of T (true) and F (false) values. For example, "T*F***FF*" . |
Returns
boolean |
True if the first geometry has the specified DE-9IM relationship with the second geometry. False if not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Relate(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y),?z) as ?relate)
WHERE {
VALUES (?x ?y ?z) {
('LINESTRING (0 0, 3 3)' 'LINESTRING (1 1, 4 4)' 'T********')
('LINESTRING (0 0, 3 3)' 'LINESTRING (1 1, 4 4)' '****T****')
}
}
ST_Distance
This function returns the distance between two geometry objects.
Syntax
geof:ST_Distance(geom1, geom2 [ , units ] [, isSpherical ])
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
units
|
URI |
Optional Unit URI having one of the following values: uom:minute , uom:second , uom:centimeter , uom:centimetre , uom:degree , uom:foot , uom:grad , uom:inch , uom:kilometer , uom:kilometre , uom:meter , uom:metre , uom:microRadian , uom:mile , uom:millimeter , uom:millimetre , uom:nauticalMile , uom:radian , uom:statuteMile , uom:surveyFootUS , or uom:yard . |
isSpherical
|
boolean |
This flag allows the ST_Distance function to explicitly control computation of the shortest spherical distance between two geometries. If isSpherical is true , the function computes the shortest spherical distance between the two geometries using only the geom1 SRID to detect axis order. The function then performs spherical calculation based on the Earth mean radius (6,371,008.7714). |
Returns
double |
The distance between the geometries. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
SELECT (geof:ST_Distance(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?distance)
WHERE {
VALUES (?x ?y) {
('Point (0 0)' 'Point (3 4)')
('Point (0 0)' 'Point (2 3)')
}
}
ST_Boundary
This function returns the boundary of a given geometry.
Syntax
geof:ST_Boundary(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The boundary of the shape. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Boundary(geof:ST_GeomFromText(?x))) as ?boundary)
WHERE {
VALUES (?x) {
('POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))')
('POLYGON ((1 1, 1 4, 4 1))')
('POLYGON ((1 1, 1 4, 4 4, 4 1))')
}
}
ST_Intersection
This function returns the intersection of two geometry objects.
Syntax
geof:ST_Intersection(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The intersection between the geometries. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Intersection(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y))) as ?intersection)
WHERE {
VALUES (?x ?y) {
('LINESTRING (8 7, 7 8)' 'LINESTRING (2 0, 2 3)')
('LINESTRING (0 2, 0 0, 2 0)' 'LINESTRING (0 3, 0 1, 1 0, 3 0)')
}
}
ST_Difference
This function returns the difference between two geometry objects.
Syntax
geof:ST_Difference(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The difference between the geometries. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Difference(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y))) as ?difference)
WHERE {
VALUES (?x ?y) {
('POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))' 'POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))')
('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))')
('POLYGON ((0 0, 0 10, 10 10, 10 0))' 'POLYGON ((0 0, 0 5, 5 5, 5 0))')
('POLYGON ((1 1,4 1, 4 4,1 4))' 'POLYGON ((2 0, 2 1, 3 1))')
}
}
ST_SymDifference
This function returns the symmetric difference between two geometry objects.
Syntax
geof:ST_SymDifference(geom1, geom2)
geom1, geom2
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The symmetric difference. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_SymDifference(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y))) as ?difference)
WHERE {
VALUES (?x ?y) {
('POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))' 'POLYGON ((1 1, 3 1, 3 3, 1 3, 1 1))')
('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))')
('POLYGON ((0 0, 0 10, 10 10, 10 0))' 'POLYGON ((0 0, 0 5, 5 5, 5 0))')
('POLYGON ((1 1,4 1, 4 4,1 4))' 'POLYGON ((2 0, 2 1, 3 1))')
}
}
ST_SRID
This function returns the spatial reference ID of a geometry.
Syntax
geof:ST_SRID(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_SRID(geof:ST_SetSRID(geof:ST_GeomFromText(?x) , 4326)) as ?SRID)
WHERE {
VALUES (?x) {
('Point (1.5 2.5)') ('Point (23.45 -78.90)')
}
}
ST_SetSRID
This function sets the spatial reference ID of a geometry and returns its coordinates.
Syntax
geof:ST_SetSRID(geom, wkid)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
wkid
|
int |
The well known reference ID. |
Returns
Custom object |
The coordinates. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_SRID(geof:ST_SetSRID(geof:ST_GeomFromText(?x) , 4326)) as ?SRID)
WHERE {
VALUES (?x) {
('Point (1.5 2.5)') ('Point (23.45 -78.90)')
}
}
ST_Dimension
This function returns the spatial dimension of a given geometry.
Syntax
geof:ST_Dimension(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
int |
The spatial dimension. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Dimension(geof:ST_GeomFromText(?x)) as ?Dimension)
WHERE {
VALUES (?x) {
('Point (1.5 2.5)') ('Point (23.45 -78.90)')
}
}
ST_Length
This function returns the length of a Line.
Syntax
geof:ST_Length(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The length of the shape. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Length(geof:ST_GeomFromText(?x)) as ?geometry_length)
WHERE {
VALUES (?x) {
('MULTILINESTRING ((1 1, 1 2),(10 10, 20 10))')
('MULTILINESTRING ((10 30, 20 20, 30 40),(40 20, 30 30, 40 20, 30 10))')
}
}
ST_Area
This function returns the area of a Polygon or MultiPolygon.
Syntax
geof:ST_Area(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The area of geometry as follows:- The planar area is returned if a geometry is passed without an SRID.
- The geodesic area is returned if a geometry is passed with SRID 4326 /CRS84.
- The spherial area is returned if a geometry is passed with SRID 4047.
|
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_Area(geof:ST_GeomFromText(?x)) as ?Area)
WHERE {
VALUES (?x) {
('POLYGON ((0 0, 0 8, 8 0, 0 0), (1 1, 1 5, 5 1, 1 1))')
('multipolygon (((10 40, 20 10, 50 10, 60 40, 50 70, 20 70),(25 20, 45 20, 45 60, 25 60)), ((30 30, 40 30, 35 50)))')
}
}
ST_CoordDim
This function returns the count of coordinate components.
Syntax
geof:ST_CoordDim(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
The count of coordinate components. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_CoordDim(geof:ST_GeomFromText(?x)) as ?coordinate_dimension)
WHERE {
VALUES (?x) {
('Point (1.5 2.5)') ('Point Z(23.45 -78.90 3)')
}
}
ST_Envelope
This function returns the envelope of a given geometry.
Syntax
geof:ST_Envelope(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The envelope. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Envelope(geof:ST_GeomFromText(?x))) as ?envelope)
WHERE {
VALUES (?x) {
('POLYGON ((2 0, 2 3, 3 0))') ('POLYGON ((2 0, 2 1, 3 1))')
}
}
ST_GeometryType
This function returns the geometry type of a geometry.
Syntax
geof:ST_GeometryType(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
string |
The geometry type. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_GeometryType(geof:ST_GeomFromText(?x)) as ?geometry_type)
WHERE {
VALUES (?x) {
('POLYGON ((2 0, 2 3, 3 0))') ('POLYGON ((2 0, 2 1, 3 1))')
}
}
ST_Union
This function returns the union of one or more geometries. Any number of geometries can be specified as input.
Syntax
geof:ST_Union(geom1 [, ..., geomN])
geom1–N
|
Object |
Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The union of geometries. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_NumPoints(geof:ST_Union(?point_2d, ?point_2d1)) as ?union)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/id> "0"^^<http://www.w3.org/2001/XMLSchema#long>;
<http://csi.com/geologic_units_24k/shape> ?shape.
?point1 a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/id> "1"^^<http://www.w3.org/2001/XMLSchema#long>;
<http://csi.com/geologic_units_24k/shape> ?shape1;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
BIND(geof:ST_GeomFromText(?shape1) as ?point_2d1)
}
ST_NumPoints
This function returns the number of Points in a geometry.
Syntax
geof:ST_NumPoints(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
int |
The number of points. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_NumPoints(geof:ST_Union(?point_2d, ?point_2d1)) as ?union)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/id> "0"^^<http://www.w3.org/2001/XMLSchema#long>;
<http://csi.com/geologic_units_24k/shape> ?shape.
?point1 a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/id> "1"^^<http://www.w3.org/2001/XMLSchema#long>;
<http://csi.com/geologic_units_24k/shape> ?shape1;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
BIND(geof:ST_GeomFromText(?shape1) as ?point_2d1)
}
ST_NumGeometries
This function returns the number of geometries in a multi-geometry shape.
Syntax
geof:ST_NumGeometries(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
int |
The number of geometries. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT (geof:ST_NumGeometries(geof:ST_GeomFromText(?multi_pt_wkt)) as ?multi_polygon)
FROM <multipolygon>
WHERE {
?multi_pt a <http://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
ST_GeometryN
This function returns the Nth geometry in a multi-geometry shape.
Syntax
geof:ST_GeometryN(geom, index)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
index
|
int |
The index of the geometry to be retrieved. |
Returns
Custom object |
The Nth geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>#
SELECT (geof:ST_AsText(geof:ST_GeometryN(geof:ST_GeomFromText(?multi_pt_wkt), 1)) as ?multi_polygon)
FROM <multipolygon>
WHERE {
?multi_pt a <http://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
ST_Centroid
This function returns the centroid of a given geometry.
Syntax
geof:ST_Centroid(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The centroid. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Centroid(geof:ST_GeomFromText(?multi_pt_wkt))) as ?multi_polygon)
FROM <multipolygon>
WHERE {
?multi_pt a <http://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
ST_Buffer
This function returns the geometry buffered by distance.
Syntax
geof:ST_Buffer(geom, distance)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
distance
|
double |
The distance value to use to get the buffer of geometry. |
Returns
Custom object |
Geometry buffered by distance. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT (geof:ST_AsText(geof:ST_Buffer(geof:ST_GeomFromText(?multi_pt_wkt), 1)) as ?multi_polygon)
FROM <multipolygon>
WHERE {
?multi_pt a <http://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
ST_ConvexHull
This function returns the convex hull of one or more geometries. Any number of geometries can be specified as input.
Syntax
geof:ST_ConvexHull(geom1 [, ..., geomN ])
geom1–N
|
Object |
Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
Convex hull. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_ConvexHull(geof:ST_GeomFromText('point(0 0)'),
geof:ST_GeomFromText('point(0 1)'), geof:ST_GeomFromText('point(1 1)')))
as ?convex_hull)
ST_GeodesicLengthWGS84
This function returns the distance (in meters) along a line of a WGS84 spheroid for geographic coordinates.
Syntax
geof:ST_GeodesicLengthWGS84(geom)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
double |
Distance in meters. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_GeodesicLengthWGS84(geof:ST_GeomFromText(?x)) as ?geodesic_length)
WHERE {
VALUES (?x) {
('<http://www.opengis.net/def/crs/EPSG/0/4326>LineString(0 0, 0.03 0.04)')
('<http://www.opengis.net/def/crs/EPSG/0/4326>MultiLineString((0 80, 0.03 80.04))')
}
}
ST_GeomFromJSON
This function returns geometry from a JSON representation of a shape.
Syntax
geof:ST_GeomFromJSON(json)
json
|
string |
Input geometry in JSON string format. The Geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon. |
Returns
Custom object |
Geometry object. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_GeomFromJSON(geof:ST_AsJSON(geof:ST_GeomFromText(?x)))) as ?line_from_json)
WHERE {
VALUES (?x) {
('LINESTRING (0 0, 2 2)') ('LINESTRING Z(8 -7 -1, -7 -1 8)')
}
}
ST_GeomFromGeoJSON
This function returns geometry from a GeoJSON representation of a shape.
Syntax
geof:ST_GeomFromGeoJSON(geojson)
geojson
|
string |
Input geometry in GeoJSON string format. The Geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon. |
Returns
Custom object |
Geometry object. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_GeomFromGeoJSON(geof:ST_AsGeoJSON(geof:ST_GeomFromText(?x)))) as ?point_from_geojson)
WHERE {
VALUES (?x) {
('POINT(10 40)')('POINT Z(-2 30 -11)')
}
}
ST_LatLonFromDMSToDD
This function returns the latitude and longitude in decimal degrees.
Syntax
geof:ST_LatLonFromDMSToDD(degrees, minutes, seconds, direction)
degrees
|
double |
Latitude and longitude degrees value. |
minutes
|
double |
Latitude and longitude minutes value. |
seconds
|
double |
Latitude and longitude seconds value. |
direction
|
URI |
Direction values (E/W/S/N) in URI format: geof:E , geof:W , geof:S , or geof:N . |
Returns
double |
Latitude and longitude in degrees. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_LatLonFromDMSToDD(137,24,13,geof:S) as ?longitude_decimal_degree)
ST_GeomFromWktLiteral
This function returns a Custom object from a WKT literal string.
Syntax
geof:ST_GeomFromWktLiteral(geom)
geom
|
WKT Literal |
Input geometry in WKT Literal format. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
Geometry object. |
Example
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_GeomFromWktLiteral(?x)) as ?is_contains)
WHERE {
VALUES (?x) {
('<http://www.opengis.net/def/crs/EPSG/0/4326>Point(33.95 -83.38)'^^geo:wktLiteral)
}
}
ST_GeomFromGmlLiteral
This function returns geometry from a GML representation of a shape.
Syntax
geof:ST_GeomFromGmlLiteral(geom)
geom
|
GMLLiteral |
Input geometry shape value in GMLLiteral format. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon. |
Returns
Custom object |
Geometry object. |
Example
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_GeomFromGmlLiteral(?x)) as ?is_contains)
WHERE {
VALUES (?x) {
('<gml:LineString gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gml:coordinates>2,0 2,3</gml:coordinates></gml:LineString>'^^geo:gmlLiteral)
}
}
ST_ConvertCoordinates
This function converts coordinates from one coordinate system to another.
Syntax
geof:ST_ConvertCoordinates(x, y, z, sourceSys, destSys)
x, y, z
|
double |
The x, y, z inputs depend on the type of conversion performed:- Cartesian to Spherical Coordinates: x, y, z
- Spherical to Cartesian Coordinates: rad, latitude, longitude
- Cartesian to Elliptical Coordinates: x, y, z
- Elliptical to Cartesian Coordinates: latitude, longitude,height
- Cartesian to Cylindrical Coordinates: x,y,z
- Cylindrical to Cartesian Coordinates: radius, longitude, z
- Cylindrical to Spherical Coordinates: radius, longitude, height
- Spherical to Cylindrical Coordinates: radius, latitude, longitude
|
sourceSys, destSys
|
URI |
String constants indicating source and destination coordinate systems. The sourceSys and destSys arguments can be passed as constants such as geof:CARTESIAN , geof:SPHERICAL , geof:CYLINDRICAL , and geof:ELLIPTICAL .
|
Returns
string |
Converted coordinates. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_ConvertCoordinates(2,3,8,geof:CARTESIAN,geof:SPHERICAL) as ?transformed_point)
ST_IsValidWKT
This function validates whether a given WKT representation is correct.
Syntax
geof:ST_IsValidWKT(wkt)
wkt
|
string |
Geometry shape value in WKT string format. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the WKT representation is correct. False if it is not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_IsValidWKT('LINESTRING(4 6,7 10)') as ?is_valid_wkt)
ST_IsValidGeoJSON
This function validates whether a given geoJSON representation is correct.
Syntax
geof:ST_IsValidGeoJSON(geojson)
geojson
|
string |
Geometry shape value in GeoJson string format. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
boolean |
True if the geoJSON representation is correct. False if it is not. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_IsValidGeoJSON(geof:ST_AsGeoJSON(geof:ST_GeomFromText('LINESTRING(4 6,7 10)'))) as ?is_valid_geojson)
ST_Translate
This function transforms a geometry with given shift values.
Syntax
geof:ST_Translate(geom, x_delta, y_delta [ , z_delta ])
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
x_delta
|
double |
Shift value for the X coordinate. |
y_delta
|
double |
Shift value for the Y coordinate. |
z_delta
|
double |
Optional shift value for the Z coordinate. For 2D translations, only the x_delta and y_delta arguments are required. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Translate(geof:ST_GeomFromText('POINT Z(14 12 10)'),1.5,2.3, -13.7)) as ?transformed_point)
ST_Scale
This function returns Point geometry translated with given scaling factor values.
Syntax
geof:ST_Scale(geom, x_sf, y_sf [, z_sf])
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
x_sf
|
double |
Scaling factor for the X coordinate. |
y_sf
|
double |
Scaling factor for the Y coordinate. |
z_sf
|
double |
Optional scaling factor for the Z coordinate. For 2D scaling, only the x_sf and y_sf arguments are required. |
Returns
Custom object |
Point geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Scale(geof:ST_GeomFromText('POINT (14 12)'),2,3)) as ?scaled_point)
ST_Shear
This function returns Point geometry translated with given shear values.
Syntax
geof:ST_Shear(geom, x_shear, y_shear [, z_shear])
Values can be passed as string constants like geo:X
, geo:Y
, or geo:Z
. The shearing factor for x, y, and z coordinates should be passed in X, Y, and Z order.
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
x_shear
|
double |
Shearing factor for the X coordinate. This value is the axis along which shearing is to be done. |
y_shear
|
double |
Shearing factor for the Y coordinate. |
z_shear
|
double |
Optional shearing factor for the Z coordinate. For 2D shearing, only the x_shear and y_shear arguments are required. |
Returns
Custom object |
Point geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Shear(geof:ST_GeomFromText('POINT (1 1)'),geof:X,2,2)) as ?scaled_point)
ST_Rotate
This function returns Point geometry translated with given rotate values.
Syntax
geof:ST_Rotate(geom, angle_rads, axis)
geom
|
Object |
Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
angle_rads
|
double |
The angle (in radians) that represents the rotational angle. |
axis
|
URI |
The axis on which the 2d or 3d rotation is performed. This is the X, Y, or Z axis depending on the direction to rotate. The value can be passed as a string constant like geo:X , geo:Y , or geo:Z . |
Returns
Custom object |
Point geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Rotate(geof:ST_GeomFromText('POINT Z(1 2 3)'),1.5708,geof:Z)) as ?rotate_point)
Aggregator (UDA) Functions
ST_Aggr_Union
This aggregate returns the union of geometries. Any number of geometries can be passed as input.
Syntax
geof:ST_Aggr_Union(geom1 [, ..., geomN])
geom1–N
|
Object |
Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The union of geometries. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_NumPoints(geof:ST_Aggr_Union(?point_2d)) as ?union)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
}
ST_Aggr_LineString
This aggregate returns Line geometry constructed from a number of Point geometries. Any number of geometries can be passed as input.
Syntax
geof:ST_Aggr_LineString(geom1 [, ..., geomN])
geom1–N
|
Object |
Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
Line geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Aggr_LineString(?point)) as ?ST_Aggr_LineString)
WHERE {
SELECT (geof:ST_Point(?x, ?y) as ?point)
WHERE {
VALUES (?x ?y) {(1 2)(2 3)(-1 2)(-2 -3)(-2 -1)}
}
}
ST_Aggr_MultiLineString
This aggregate returns MultiLine geometry constructed from a number of line geometries. Any number of geometries can be passed as input.
Syntax
geof:ST_Aggr_MultiLineString(geom1 [, ..., geomN])
geom1–N
|
Object |
LineString or MultiLineString geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
MultiLine geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Aggr_MultiLineString(?point)) as ?agg_multiline)
WHERE {
SELECT (geof:ST_GeomFromText(?x) as ?point)
WHERE {
VALUES (?x) {('LINESTRING (8 7, 7 8)')('LINESTRING (1 7, 7 8)')}
}
}
ST_Aggr_MultiPoint
This aggregate returns MultiPoint geometry constructed from a number of Point geometries. Any number of geometries can be passed as input.
Syntax
geof:ST_Aggr_MultiPoint(geom1 [, ..., geomN])
geom1–N
|
Object |
Point geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
MultiPoint geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Aggr_Multipoint(?point)) as ?agg_multipoint)
WHERE {
SELECT (geof:ST_Point(?x, ?y) as ?point)
WHERE {
VALUES (?x ?y) {(1 2)(2 3)
}
}
}
ST_Aggr_Polygon
Using aggregate Point geometries, this aggregate returns Polygon geometry constructed from a number of Point geometries. Any number of geometries can be passed as input.
Syntax
geof:ST_Aggr_Polygon(geom1 [, ..., geomN])
geom1–N
|
Object |
Point or Polygon geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
Polygon geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Aggr_Polygon(?point)) as ?agg_polygon)
WHERE {
SELECT (geof:ST_Point(?x, ?y) as ?point)
WHERE {
VALUES (?x ?y) {(1 2)(2 3)(-1 2)(-2 -1)(-2 -3)
}
}
}
ST_Aggr_MultiPolygon
This aggregate returns MultiPolygon geometry constructed from multiple polygon geometries. Any number of geometries can be passed as input.
Syntax
geof:ST_Aggr_MultiPolygon(geom1 [, ..., geomN])
geom1–N
|
Object |
Polygon geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. |
Returns
Custom object |
MultiPolygon geometry. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_Aggr_MultiPolygon(?point)) as ?agg_multipolygon)
WHERE {
SELECT (geof:ST_GeomFromText(?x) as ?point)
WHERE {
VALUES (?x) {('POLYGON ((2 0, 2 3, 3 0))')('POLYGON ((11 12,-11 -12,11 -12))')
}
}
}
ST_Aggr_ConvexHull
This aggregate returns the convex hull from the specified geometries. Any number of geometries can be passed as input.
Syntax
geof:ST_Aggr_ConvexHull(geom1 [, ..., geomN])
geom1–N
|
Object |
Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The convex hull from the geometries. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_NumPoints(geof:ST_Aggr_ConvexHull(?point_2d)) as ?convex_hull)
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
}
ST_Aggr_Intersection
This aggregate returns the intersection of given geometries that have the same SRID. Any number of geometries can be passed as input.
Syntax
geof:ST_Aggr_Intersection(geom1 [, ..., geomN])
geom1–N
|
Object |
Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the Graph Lakehouse Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection. |
Returns
Custom object |
The intersection between geometries. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_NumPoints(geof:ST_Aggr_Intersection(?point_2d)) as ?union
FROM <point>
WHERE {
?point a <http://csi.com/geologic_units_24k/point>;
<http://csi.com/geologic_units_24k/shape> ?shape;
BIND(geof:ST_GeomFromText(?shape) as ?point_2d)
}
Services (UDS) Functions
- ST_ReadSHP: Returns geometry objects extracted from a Shapefile (SHP).
- ST_ReadKML: Returns geometry objects extracted from a Keyhole Markup Language (KML) file.
- ST_ReadGeoJSON: Returns geometry objects extracted from a JSON file.
- ST_ReadText: Returns geometry objects extracted from a Well-Known Text (WKT) file.
- ST_ReadGML: Returns geometry objects extracted from a Geography Markup Language (GML) file.
- ST_ReadWKB: Returns geometry objects extracted from an OpenGIS Well-known Binary (WKB) file.
ST_ReadSHP
This function returns geometry objects extracted from a .shp file.
Syntax
geof:ST_ReadSHP("/path/file")
/path/file
|
string |
The location and file name of the .shp file to read. |
Returns
Custom object |
Objects extracted from the file. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT *
WHERE {
SERVICE <http://www.opengis.net/def/function/geosparql/ST_ReadSHP>("{CURRENT_DIR}/../data/Road_Centerline.shp"){}
}
ST_ReadKML
This function returns geometry objects and properties extracted from a .kml file.
Syntax
geof:ST_ReadKML("/path/file")
/path/file
|
string |
The location and file name of the .kml file to read. |
Returns
Custom object |
Objects extracted from the file. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT * WHERE {
SERVICE <http://www.opengis.net/def/function/geosparql/ST_ReadKML>("{CURRENT_DIR}/../data/Snow_Emergency_Routes.kml") {}
}
ST_ReadGeoJSON
This function returns geometry objects and properties extracted from a .json file.
Syntax
geof:ST_ReadGeoJSON("/path/file")
/path/file
|
string |
The location and file name of the .json file to read. |
Returns
Custom object |
Objects extracted from the file. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT * WHERE {
SERVICE <http://www.opengis.net/def/function/geosparql/ST_ReadGeoJSON>("{CURRENT_DIR}/../data/geometry_collection.json") {}
}
ST_ReadText
This function returns geometry objects and properties extracted from a .wkt file.
Syntax
geof:ST_ReadText("/path/file")
/path/file
|
string |
The location and file name of the .wkt file to read. |
Returns
Custom object |
Objects extracted from the file. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT * WHERE {
SERVICE <http://www.opengis.net/def/function/geosparql/ST_ReadText>("{CURRENT_DIR}/../data/single_geometryWkt.wkt") {}
}
ST_ReadGML
This function returns geometry objects and properties extracted from a .gml file.
Syntax
geof:ST_ReadGML("/path/file")
/path/file
|
string |
The location and file name of the .gml file to read. |
Returns
Custom object |
Objects extracted from the file. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT * WHERE {
SERVICE <http://www.opengis.net/def/function/geosparql/ST_ReadGML>("{CURRENT_DIR}/../data/single_geometryGml.gml") {}
}
ST_ReadWKB
This function returns geometry objects and properties extracted from .wkb file.
Syntax
geof:ST_ReadWKB("/path/file")
/path/file
|
string |
The location and file name of the .wkb file to read. |
Returns
Custom object |
Objects extracted from the file. |
Example
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT * WHERE {
SERVICE <http://www.opengis.net/def/function/geosparql/ST_ReadWKB>("{CURRENT_DIR}/../data/single_geometryWkb.wkb") {}
}