Geospatial Functions

AnzoGraph DB offers two packages of pre-built geospatial functions that you can use in the same way as other native, built-in functions. The spatial features offer advanced capabilities for developing large scale location intelligence and geospatial applications to use along with rich data SPARQL analytics. Both sets of functions have been developed in compliance with OGC standards (https://www.ogc.org/standards).

Geospatial

Geospatial Data Types and Arguments

Arguments and return values are transient objects that are internal to AnzoGraph DB. 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 AnzoGraph DB 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
  • AnzoGraph DB Custom geometry data type (wrapper encapsulation of the OGCGeometry standard data type from the ESRI library)

The AnzoGraph DB functions follow specific standards for reading and parsing particular geometry values. For GML readers and GML literal values, AnzoGraph DB functions support GML version 2.0 and, by default, use the CRS 84 coordinate system. The Shape (.shp) file reader supports version 1000. For WKT geometry parsing, AnzoGraph DB functions follow the WKT version 1 standard and, by default, use the 4326 coordinate system. The KML reader follows the version 2.2.0 standard.

Geospatial Functions

The geospatial functions, implemented using ESRI’s public domain API geometry library, categorize functions to operate on the following geometric shapes:

  • Point: A point shape or geometry that represents a single location in space that has, at a minimum, an x-coordinate and y-coordinate.
  • MultiPoint: An ordered collection of points.
  • LineString: A shape defined by sequence of points with boundary endpoints.
  • MultiLineString: A collection of individual LineStrings.
  • Polygon: A multi-sided, two-dimensional shape stored as a sequence of points defining its exterior bounding ring and optionally one or more interior polygon rings.
  • MultiPolygon: A collection of polygons, each having one or more interior polygon rings.
  • Circle Arc Polygon: A specialized circular arc polygon defined by a radius and an arc/chord length or delta angle.
  • Elliptical Arc Polygon: A specialized polygon geometry that describes some portion of an elliptical polygon.
  • Circle Polygon: A circular-shaped geometry defined by the circle's center point and its radius.
  • Ellipse Polygon: An elliptical-shaped geometry constructed from two points that define the center and angle of the ellipse, and two additional points that specify the total length of the major and minor axes.
  • Rectangle Polygon: A rectangular-shaped geometry defined by its corner points and corner angles.
  • Squircle Polygon: A hybrid-shaped geometry that combines properties of both a square and a circle, for example, a square object with rounded corners.

In addition, the AnzoGraph DB includes the following types of geospatial functions:

  • Utility Functions: Functions that are common to all shapes and provide operations such as conversion, translation, or conditional testing
  • Aggregator (UDA) Functions: Aggregators that construct new geometric shapes from multiple aggregated geometries.
  • Services (UDS) Functions: Services that extract geometric information from various source files such as .shp, .gml, .kml, and .json.

Click a geometric shape type in the list below to view the available functions for that type:

Point and Multipoint Functions

  • ST_Point: Constructs a Point geometry from a given set of x, y, z, and m coordinates.
  • ST_X: Returns the X coordinate of a given Point geometry.
  • ST_SetX: Sets the X coordinate of a given Point geometry.
  • ST_Y: Returns the Y coordinate of a given Point geometry.
  • ST_SetY: Sets the Y coordinate of a given Point geometry.
  • ST_Z: Returns the Z coordinate of a given Point geometry.
  • ST_SetZ: Sets the Z coordinate of a given Point geometry.
  • ST_M: Returns the M coordinate of a given Point geometry.
  • ST_SetM: Sets the M coordinate of a given Point geometry.
  • ST_Bin: Returns the bin ID of a given Point geometry.
  • ST_BinEnvelope: Returns the bin envelope for a given Point geometry 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 given MultiPoint.

ST_Point

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

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Point(x, y [, z ] [, m ])
Argument Data Type Description
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

Data Type Description
Custom object The point.

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_X

Returns the X coordinate of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_X(geom) 
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
double The X coordinate.

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

Sets the X coordinate of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_SetX(geom, x)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.
x double The X coordinate point value to set.

Returns

Data Type Description
Custom object The X coordinate.

Example

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_SetX(geof:ST_Point(1,2),4)) as ?point)

ST_Y

Returns the Y coordinate of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Y(geom)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
double The Y coordinate.

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

Sets the Y coordinate of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_SetY(geom, y)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.
y double The Y coordinate point value to set.

Returns

Data Type Description
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

Returns the Z coordinate of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Z(geom) 
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
double The Z coordinate.

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

Sets the Z coordinate of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_SetZ(geom, z)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.
z double The Z coordinate point value to set.

Returns

Data Type Description
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

Returns the M coordinate of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_M(geom)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
double The M coordinate.

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

Sets the M coordinate of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_SetM(geom, m)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.
m double The M coordinate point value to set.

Returns

Data Type Description
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

Returns the bin ID of a given Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Bin(binSize, geom)
Argument Data Type Description
binSize double The bin size.
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
long The bin ID.

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

Returns the bin envelope for a given Point geometry or bin ID. You can also return the bin envelope for multiple Points.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_BinEnvelope(binSize, geom)
Argument Data Type Description
binSize double The bin size.
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

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

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MultiPoint(x, y [, xx ] [, yy ]) 
Argument Data Type Description
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

Data Type Description
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

Returns a Point that is at the Nth index in a given MultiPoint.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_PointN(geom, index)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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))')
  }
}

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 given line.
  • ST_EndPoint: Returns the end Point of a given line.
  • ST_IsClosed: Determines whether a given line geometry is a ring.
  • ST_IsRing: Determines whether a given geometry is closed.
  • ST_MultiLineString: Returns the MultiLine geometry constructed from a list of Line geometries.

ST_LineString

Returns a LineString as a custom object constructed from a number of point geometries. Any number of Point geometries can be specified to form a new line.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_LineString(point1 [, ..., pointN])
Argument Data Type Description
point1–N Object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

Returns the start Point of a given line.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_StartPoint(line)
Argument Data Type Description
line Object LineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

Returns the end Point of a given line.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_EndPoint(line)
Argument Data Type Description
line Object LineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

Determines whether a given geometry is closed.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_IsClosed(line)
Argument Data Type Description
line Object LineString or MultiLineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

Determines whether a given line geometry is a ring.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_IsRing(line)
Argument Data Type Description
line Object LineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

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

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MultiLineString(line1 [, ..., lineN])
Argument Data Type Description
line1–N Object LineString geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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 and Other Geometric Functions

  • ST_Polygon: Returns a Polygon geometry constructed from multiple point geometries.
  • ST_ExteriorRing: Returns the exterior ring of a given polygon geometry.
  • ST_NumInteriorRing: Returns the number of interior rings that exist in a given polygon geometry.
  • ST_InteriorRingN: Returns the interior ring at the Nth index position in a given polygon geometry.
  • ST_MultiPolygon: Returns a MultiPolygon geometry constructed from a list of polygons.
  • ST_Circle: Returns a Circle Polygon from a given radius, and x, y, and z coordinates.
  • ST_CircleArc: Returns a Circle Arc Polygon from a given radius and point geometry.
  • ST_Arc: Returns an Arc line from a given start angle and size angle.
  • ST_Ellipse: Returns an Ellipse Polygon from a given radius and point geometry.
  • ST_EllipticalArc: Returns an Elliptical Arc Polygon from a given radius and point geometry.
  • ST_Rectangle: Returns a Rectangle Polygon from a given height, width, and point geometry.
  • ST_Squircle: Returns a Squircle Polygon from a given radius and point geometry.
  • ST_GeomFromGML: Returns geometry based on GML specification.
  • ST_GeomFromText: Constructs a geometry from a given set of well known text (WKT) coordinates.
  • ST_GeomFromWKB: Constructs a geometry from a given set of well known binary (WKB) coordinates.

ST_Polygon

Returns Polygon geometry constructed from multiple Point geometries.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Polygon(point1 [, ..., pointN])
Argument Data Type Description
point1–N Object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns the exterior ring of a given polygon geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_ExteriorRing(polygon)
Argument Data Type Description
polygon Object Polygon geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

Returns the number of interior rings that exist in a given polygon geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_NumInteriorRing(polygon)
Argument Data Type Description
polygon Object Polygon geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

Returns the interior ring at the Nth index position in a given polygon geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_InteriorRingN(polygon, n)
Argument Data Type Description
polygon Object Polygon geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.
n int The index of the interior ring to retrieve from the specified polygon.

Returns

Data Type Description
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

Returns MultiPolygon geometry constructed from a list of polygons. Any number of Polygon geometries can be specified as input.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MultiPolygon(polygon1 [, ..., polygonN])
Argument Data Type Description
polygon1–N Object Polygon geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

Returns

Data Type Description
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

Returns a Circle Polygon from a given radius and Point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Circle(geom, radius, numOfPoints)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns circular arc polygon given radius parameters and number of point arguments.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_CircleArc(geom, startRad, sizeRad, radius, numOfPoints)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns an Arc given a center point, radius, start and size angle, and number of points arguments.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Arc(x, y, radius, startRad, sizeRad, numOfPoints)
Argument Data Type Description
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

Data Type Description
Custom object The arc.

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

Return an Ellipse Polygon based on a given radius and point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Ellipse(geom, xRadius, yRadius, numOfPoints)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns an Elliptical Arc Polygon from the given radius and point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_EllipseArc(geom, startRad, sizeRad, width, height, numOfPoints)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Return a Rectangle Polygon from a given height, width, and point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Rectangle(geom, width, height, numOfPoints)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Return a Squircle Polygon from a given radius and point geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Squircle(geom, radius, numOfPoints)
Argument Data Type Description
geom object Point geometry in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns geometry based on a GML specification.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeomFromGML(gml)
Parameter Data Type Description
gml string Input geometry in GMLLiteral format. The geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon.

Returns

Data Type Description
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)

ST_GeomFromText

Returns a Point as a custom object constructed from a given set of well known free text (WKT) coordinates.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeomFromText(wkt [, SRID ] )
Parameter Data Type Description
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

Data Type Description
Custom object The point.

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

Returns a Point as a custom object constructed from a given set of well known binary (WKB) coordinates.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeomFromWKB(wkb_hexstr [, wkid ] )
Parameter Data Type Description
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

Data Type Description
Custom object The point.

Example

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
SELECT (geof:ST_AsText(geof:ST_GeomFromWKB(?val)) as ?geom)
WHERE {
  VALUES (?val) {('000000000140000000000000004010000000000000')}
}

Utility Functions

  • ST_MinX: Returns the minimum value of the X coordinate for a given geometry.
  • ST_MaxX: Returns the maximum value of the X coordinate for a given geometry.
  • ST_MinY: Returns the minimum value of the Y coordinate for a given geometry.
  • ST_MaxY: Returns the maximum value of the Y coordinate for a given geometry.
  • ST_MinZ: Returns the minimum value of Z coordinate for a given geometry.
  • ST_MaxZ: Returns the maximum value of Z coordinate for a given geometry.
  • ST_MinM: Returns the minimum measure value for a given geometry.
  • ST_MaxM: Returns the maximum measure value for a given geometry.

Serialization

  • ST_AsGeoJSON: Returns a GeoJSON representation of a geometric shape.
  • ST_AsJSON: Returns a JSON representation of a geometric shape.
  • ST_AsBinary: Returns a binary object from a given geometry.
  • ST_AsText: Returns a well known text (WKT) representation of a geometric shape.
  • ST_AsGML: Returns geometry from a GML representation of a geometric shape.
  • ST_AsWktLiteral: Returns a URL from WKT representation of a given geometry.
  • ST_AsGmlLiteral: Returns a URL from GML representation of a given geometry.
  • ST_AsWKB_HEX: Returns a hex string from WKB representation of a given geometry.

Logical, Comparison, and Relational Operations

  • ST_Is3D: Determines if a given geometry object is three-dimensional.
  • ST_IsEmpty: Determines if a given geometry object is empty.
  • ST_IsMeasured: Determines if a given geometry object is measured.
  • ST_IsSimple: Determines if a given geometry object is simple.
  • ST_Crosses: Determines if geometry1 crosses geometry2.
  • ST_Contains: Determines if geometry1 contains geometry2.
  • ST_Disjoint: Determines if geometry1 doesn’t have 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 given geometry.
  • ST_SetSRID: Sets the spatial reference ID of a given geometry and returns its geometry coordinates.
  • ST_Dimension: Returns the spatial dimension of a given 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 given geometry.
  • ST_GeometryType: Returns the geometry type of a given geometry.
  • ST_Union: Returns the union of one or more geometries.
  • ST_NumPoints: Returns the number of Points in a given 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 given 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 any geometric shape.
  • ST_GeomFromGeoJSON: Returns the geometry from a GeoJSON representation of any geometric shape.
  • ST_LatLonFromDMSToDD: Returns latitude and longitude in decimal degrees.
  • ST_GeomFromWktLiteral: Returns geometry object from a WKT representation of a given shape.
  • ST_GeomFromGmlLiteral: Returns geometry object from a GML representation of a given 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: Transform a geometry with given shift values.
  • ST_Scale: Scales a geometry to a new size using the corresponding factor arguments.
  • ST_Shear: Shears a geometry around axis using specified shearing arguments.
  • ST_Rotate: Rotate geometry around origin using corresponding rotation arguments.

ST_MinX

Returns the minimum value of the X coordinate for a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MinX(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the maximum value of the X coordinate for a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MaxX(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the minimum value of the Y coordinate for a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MinY(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the maximum value of the Y coordinate for a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MaxY(geom) 
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the minimum value of the Z coordinate for a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MinZ(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the maximum value of the Z coordinate for a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MaxZ(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the minimum value of measure for a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MinM(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the maximum value of measure for a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_MaxM(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns a GeoJSON representation of any geometric shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_AsGeoJSON(geom) 
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns a JSON representation of any geometric shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_AsJSON(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns a binary object from a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_AsBinary(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the well known text (WKT) representation of any geometric shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_AsText(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
string The WKT representation of the shape.

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_AsGML

Returns geometry from the GML representation of a geometric shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_AsGML(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
string The geometry.

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

Returns a URL from a well known text (WKT) representation of a geometric shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
geo:ST_AsWktLiteral(geom)  
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns a URL from the GML representation of a geometric shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
geo:ST_AsGmlLiteral(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns a hex string from the WKB representation of a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_AsWKB_HEX(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
string The hex string.

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

Determines whether the specified geometry object is three-dimensional.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Is3D(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Determines if the specified geometry object is empty.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_IsEmpty(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether a given geometry object is measured.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_IsMeasured(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether a given geometry object is simple.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_IsSimple(geom) 
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether geometry1 crosses geometry2.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Crosses(geom1, geom2) 
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether geometry1 contains geometry2.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Contains(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether geometry1 is disjoint with geometry2, i.e., whether geometry1 has any points in common with geometry2.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Disjoint(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether geometry1 equals geometry2.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Equals(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Determines if geometry1 intersects geometry2.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Intersects(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether geometry1 overlaps geometry2.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Overlaps(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether geometry1 touches geometry2, i.e., tests whether they have any points in common.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Touches(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether geometry1 is within geometry2.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Within(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests if the envelopes of geometry1 and geometry2 intersect.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_EnvIntersects(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Tests whether geometry1 has the specified DE-9IM relationship with geometry2.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Relate(geom1, geom2, "pattern_matrix")
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns the distance between two geometry objects.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
geof:ST_Distance(geom1, geom2 [ , units ] [, isSpherical ])
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns the boundary of a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Boundary(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the intersection of two geometry objects.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Intersection(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the difference between two geometry objects.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Difference(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the symmetric difference between two geometry objects.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_SymDifference(geom1, geom2)
Parameter Data Type Description
geom1, geom2 Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the spatial reference ID of a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_SRID(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
int The SRID.

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

Sets the spatial reference ID of a given geometry and returns its geometry coordinates.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_SetSRID(geom, wkid)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns the spatial dimension of a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Dimension(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the length of a Line.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Length(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the area of a Polygon or MultiPolygon.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Area(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the count of coordinate components.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_CoordDim(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the envelope of a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Envelope(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the geometry type of a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeometryType(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the union of one or more geometries. Any number of geometries can be specified as input.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Union(geom1 [, ..., geomN])
Parameter Data Type Description
geom1–N Object Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the number of Points in a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_NumPoints(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the number of geometries in a multi-geometry shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_NumGeometries(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the Nth geometry in a multi-geometry shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeometryN(geom, index)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns the centroid of a given geometry.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Centroid(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the geometry buffered by distance.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_Buffer(geom, distance)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

Data Type Description
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

Returns the convex hull of one or more geometries. Any number of geometries can be specified as input.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_ConvexHull(geom1 [, ..., geomN ])
Parameter Data Type Description
geom1–N Object Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns the distance (in meters) along a line of a WGS84 spheroid for geographic coordinates.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeodesicLengthWGS84(geom)
Parameter Data Type Description
geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

Returns

Data Type Description
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

Returns geometry from a JSON representation of any geometric shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeomFromJSON(json)
Parameter Data Type Description
json string Input geometry in JSON string format. The Geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon.

Returns

Data Type Description
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

Returns geometry from a GeoJSON representation of any geometric shape.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeomFromGeoJSON(geojson)
Parameter Data Type Description
geojson string Input geometry in GeoJSON string format. The Geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon.

Returns

Data Type Description
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

Returns the latitude and longitude in decimal degrees.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_LatLonFromDMSToDD(degrees, minutes, seconds, direction)
Parameter Data Type Description
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

Data Type Description
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

Returns a Custom object from a WKT literal string.

Syntax

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeomFromWktLiteral(geom)
Parameter Data Type Description
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

Data Type Description
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

Returns geometry from a GML representation of a given shape.

Syntax

PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_GeomFromGmlLiteral(geom)
Parameter Data Type Description
geom GMLLiteral Input geometry shape value in GMLLiteral format. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, or Multipolygon.

Returns

Data Type Description
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

Return coordinates converted from one coordinate system to another.

Syntax

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
geof:ST_ConvertCoordinates(x, y, z, sourceSys, destSys)
Parameter Data Type Description
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

    Data Type Description
    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

    Validates whether a given WKT representation is correct.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_IsValidWKT(wkt)
    Parameter Data Type Description
    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

    Data Type Description
    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

    Validates whether a given geoJSON representation is correct.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_IsValidGeoJSON(geojson)
    Parameter Data Type Description
    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

    Data Type Description
    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

    Transforms a geometry with given shift values.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Translate(geom, x_delta, y_delta [ , z_delta ])
    Parameter Data Type Description
    geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

    Returns Point geometry translated with given shift values.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Scale(geom, x_sf, y_sf [, z_sf])
    Parameter Data Type Description
    geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

    Data Type Description
    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

    Returns Point geometry translated with given shift values.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Shear(geom, x_shear, y_shear [, z_shear])
    Parameter Data Type Description
    geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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.

    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.

    Returns

    Data Type Description
    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

    Returns Point geometry translated with given shift values.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Rotate(geom, angle_rads, axis)
    Parameter Data Type Description
    geom Object Geometry shape value in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB 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

    Data Type Description
    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

    Click a function name in the list below to view the syntax and see details about function arguments and return values.

    ST_Aggr_Union

    Using aggregator transformation, returns the union of geometries. Any number of geometries can be passed as input.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Aggr_Union(geom1 [, ..., geomN])
    Parameter Data Type Description
    geom1–N Object Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

    Returns

    Data Type Description
    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

    Using aggregator transformation, returns Line geometry constructed from a number of Point geometries. Any number of geometries can be passed as input.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Aggr_LineString(geom1 [, ..., geomN])
    Parameter Data Type Description
    geom1–N Object Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

    Returns

    Data Type Description
    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

    Using aggregator transformation, returns MultiLine geometry constructed from a number of line geometries. Any number of geometries can be passed as input.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Aggr_MultiLineString(geom1 [, ..., geomN])
    Parameter Data Type Description
    geom1–N Object LineString or MultiLineString geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

    Returns

    Data Type Description
    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

    Using aggregator transformation, returns MultiPoint geometry constructed from a number of Point geometries. Any number of geometries can be passed as input.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Aggr_MultiPoint(geom1 [, ..., geomN])
    Parameter Data Type Description
    geom1–N Object Point geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

    Returns

    Data Type Description
    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 and aggregator transformation, returns Polygon geometry constructed from a number of point geometries. Any number of geometries can be passed as input.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Aggr_Polygon(geom1 [, ..., geomN])
    Parameter Data Type Description
    geom1–N Object Point or Polygon geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

    Returns

    Data Type Description
    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

    Uses aggregator transformation to return MultiPolygon geometry constructed from multiple polygon geometries. Any number of geometries can be passed as input.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Aggr_MultiPolygon(geom1 [, ..., geomN])
    Parameter Data Type Description
    geom1–N Object Polygon geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type.

    Returns

    Data Type Description
    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

    Uses aggregator transformation to return the convex hull from the specified geometries. Any number of geometries can be passed as input.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Aggr_ConvexHull(geom1 [, ..., geomN])
    Parameter Data Type Description
    geom1–N Object Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

    Returns

    Data Type Description
    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

    Returns the intersection of given geometries that have the same SRID. Any number of geometries can be passed as input.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_Aggr_Intersection(geom1 [, ..., geomN])
    Parameter Data Type Description
    geom1–N Object Geometry shape values in WKT string format, WKTLiteral, GMLLiteral, or the AnzoGraph DB Custom OGCGeometry data type. The input geometry shape can be a Point, Multipoint, LineString, MultiLineString, Polygon, Multipolygon, or GeometryCollection.

    Returns

    Data Type Description
    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

    Click a function name in the list below to view the syntax and see details about function arguments and return values.

    • 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

    Returns geometry objects extracted from a .shp file.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_ReadSHP("/path/file")
    Parameter Data Type Description
    /path/file string The location and file name of the .shp file to read.

    Returns

    Data Type Description
    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

    Returns geometry objects and properties extracted from a .kml file.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_ReadKML("/path/file")
    Parameter Data Type Description
    /path/file string The location and file name of the .kml file to read.

    Returns

    Data Type Description
    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

    Returns geometry objects and properties extracted from a .json file.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_ReadGeoJSON("/path/file")
    Parameter Data Type Description
    /path/file string The location and file name of the .json file to read.

    Returns

    Data Type Description
    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

    Returns geometry objects and properties extracted from a .wkt file.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_ReadText("/path/file")
    Parameter Data Type Description
    /path/file string The location and file name of the .wkt file to read.

    Returns

    Data Type Description
    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

    Returns geometry objects and properties extracted from a .gml file.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_ReadGML("/path/file")
    Parameter Data Type Description
    /path/file string The location and file name of the .gml file to read.

    Returns

    Data Type Description
    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

    Returns geometry objects and properties extracted from .wkb file.

    Syntax

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ST_ReadWKB("/path/file")
    Parameter Data Type Description
    /path/file string The location and file name of the .wkb file to read.

    Returns

    Data Type Description
    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") {} 
    }
    

    GeoSPARQL

    This section provides a summary of the various geometry shape classes, subclasses, data types, properties, and relationships that GeoSPARQL supports and AnzoGraph DB GeoSPARQL functions operate on.

    • GeoSPARQL OWL classes and subclasses: The GeoSPARQL OWL specification describes various classes that are supported (for example, geo:SpatialObject and geo:Feature), their subclasses (geo:Geometry), and associated properties and relationships (geo:hasGeometry, geo:hasDefaultGeometry, geo:dimension, geo:coordinateDimension, geo:spatialDimension, geo:isEmpty, geo:isSimple, geo:hasSerialization).

      GeoSPARQL RDF data must also conform to the OWL representation and implement the features and properties as described in the OGC GeoSPARQL specification.

    • GeoSPARQL Data Types: GeoSPARQL uses some custom data types, namely, geo:wktLiteral and geo:gmlLiteral to represent serialized geometry shapes in text form. Function arguments that specify geometries may pass those objects as wktLiteral, gmlLiteral, or string literals defined in the <http://www.opengis.net/ont/geosparql#> namespace. Units of measurement (UOM) such as kilometer, meter, mile, degree, and radian are defined in the <http://www.opengis.net/def/uom/OGC/1.0/> namespace.

      In AnzoGraph DB, these literals are represented as RDFLiteral objects, which is a combination of a string and a data type URI. All of the geometries are represented in the graph as either WKT (well-known-text format) or GML (Geometry Markup Language) serialization forms. They may also be represented as objects or string literals.

    • GeoSPARQL Relational Properties: GeoSPARQL introduces a set of properties to be used in SPARQL graph patterns. There are three types of relational families: Simple Features (sf), Egenhofer (eh), and RCC8 (rcc8).

    GeoSPARQL Functions

    This section lists the GeoSPARQL functions supported in AnzoGraph DB:

    For additional information on the operation of functions, see the Geographic Query Language for RDF Data specification.

    Non-Topological Functions

    • distance: Computes the shortest distance between two geometries.
    • buffer: Returns a geometric object that represents all points whose distance from a geometry is less than or equal to the specified radius.
    • convexHull: Returns a geometric object that represents all points in the convex hull of the specified geometry.
    • intersection: Returns all points that intersect two geometries.
    • union: Returns all points in the union of two geometries.
    • difference: Returns all points in the set of difference between two geometries.
    • symDifference: Returns all points in the set of symmetric difference between two geometries.
    • envelope: Returns the minimum bounding box of the specified geometry.
    • boundary: Returns the closure of the boundary of the specified geometry.
    • getSRID: Returns the spatial reference system URI for the specified geometry.
    • relate: Returns true or false depending on whether the spatial relationship between the specified geometries corresponds to the specified pattern matrix.

    distance

    This function takes two geometries as input and computes the shortest distance between them based on the SRID of the first geometry. The function converts the distance in meters to the specified unit of measure.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
    geof:distance(geom1, geom2, units)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.
    units URI The unit of measure in OGC format.

    If no SRID is specified in geom1 or geom2, the function assumes CRS84 as the default unit of measure and assumes coordinates in Long, Lat format. If geom1 and geom2 are specified as WKT strings and no SRID details are provided, the function computes the Euclidean distance between the two geometries regardless of what unit of measure is provided.

    To find the spherical distance between two geometries, you can use 4047 as the SRID. The 4047 value specifies a spherical coordinate system number. The spherical distance gets computed based on Great circle algorithms, and Planer geodesics distances are computed using ellipsoidal formulas.

    Returns

    Data Type Description
    double The shortest distance.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
    SELECT (geof:distance(?x,?y,?z) as ?distance)
    WHERE {
      VALUES (?x ?y ?z) {
      ('<http://www.opengis.net/def/crs/EPSG/0/4326>Point (0 0)' '<http://www.opengis.net/def/crs/EPSG/0/4326>Point (3 4)' uom:millimeter)
      ('<http://www.opengis.net/def/crs/EPSG/0/4326>Point (0 0)' '<http://www.opengis.net/def/crs/EPSG/0/4326>Point (3 4)' uom:kilometer)
      ('<http://www.opengis.net/def/crs/EPSG/0/4326>Point (0 0)' '<http://www.opengis.net/def/crs/EPSG/0/4326>Point (3 4)' uom:metre)
      ('<http://www.opengis.net/def/crs/EPSG/0/4326>Point (0 0)' '<http://www.opengis.net/def/crs/EPSG/0/4326>Point (3 4)' uom:foot)
      }
    }

    buffer

    This function takes a geomLiteral and radius argument in a given unit of measure and produces a polygon of points that has a distance less than or equal to the given radius from a central geomLiteral position. The input radius is converted from the source unit of measure based on 1° equal to 111 km and returns the polygon of points less than or equal to the distance from the geomLiteral position on an XY plane.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
    geof:buffer(geom, radius, units)
    Parameter Data Type Description
    geom geomLiteral The geometry.
    radius double The radius of the geometry.
    units URI The unit of measure in OGC format.

    Returns

    Data Type Description
    geomLiteral Polygon of points.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
    SELECT (geof:buffer(?x,?y,?z) as ?buffer)
    WHERE {
      VALUES (?x ?y ?z) {
        ('Point (0 0)' 2 uom:meter)
        ('POLYGON ((1 1 , 1 4, 4 4, 4 1))'^^geo:wktLiteral 20 uom:millimeter)
      }
    }

    convexHull

    This function returns a geometric object that represents all points in the convex hull of the geometry. Calculations are in the spatial reference system of the specified geometry.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    PREFIX uom: <http://www.opengis.net/def/uom/OGC/1.0/>
    geof:convexHull(geom)
    Parameter Data Type Description
    geom geomLiteral The geometry.

    Returns

    Data Type Description
    geomLiteral All points in the convex hull.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:convexHull(?x) as ?convexHull)
    WHERE {
      VALUES (?x) {
        ('POINT(1 2)')
        ('<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)
        ('POLYGON ((1 1 , 1 4, 4 4, 4 1))'^^geo:wktLiteral)
      }
    }

    intersection

    This function returns a geometric object that represents all points in the intersection of the input geometries. Calculations are in the spatial reference system of the first geometry.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:intersection(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    geomLiteral All points in the intersection.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:intersection(?x,?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)')
      }
    }

    union

    This function returns a geometric object that represents all points in the union of two geometries. Calculations are in the spatial reference system of the first geometry.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:union(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    geomLiteral All points in the union.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:union(?x,?y) as ?union)
    WHERE {
      VALUES (?x ?y) {
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>LINESTRING (8 7, 7 8)'^^geo:wktLiteral '<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)
        ('LINESTRING (0 2, 0 0, 2 0)'^^geo:wktLiteral 'LINESTRING (0 3, 0 1, 1 0, 3 0)'^^geo:wktLiteral)
      }
    }

    difference

    This function returns a geometric object that represents all points in the set of difference between two geometries. Calculations are in the spatial reference system of the first geometry.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:difference(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    geomLiteral All points in the set of difference.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:difference(?x,?y) as ?intersection)
    WHERE {
      VALUES (?x ?y) {
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>LINESTRING (8 7, 7 8)'^^geo:wktLiteral '<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)
        ('LINESTRING (0 2, 0 0, 2 0)'^^geo:wktLiteral 'LINESTRING (0 3, 0 1, 1 0, 3 0)'^^geo:wktLiteral)
      }
    }

    symDifference

    This function returns a geometric object that represents all points in the set of symmetric difference between two geometries. Calculations are in the spatial reference system of the first geometry.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:symDifference(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    geomLiteral All points in the symmetric difference.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:symDifference(?x,?y) as ?symdiff)
    WHERE {
      VALUES (?x ?y) {
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>LINESTRING (8 7, 7 8)'^^geo:wktLiteral '<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)
        ('LINESTRING (0 2, 0 0, 2 0)'^^geo:wktLiteral 'LINESTRING (0 3, 0 1, 1 0, 3 0)'^^geo:wktLiteral)
      }
    }

    envelope

    This function returns the minimum bounding box of the specified geometry.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:envelope(geom)
    Parameter Data Type Description
    geom geomLiteral The geometry.

    Returns

    Data Type Description
    geomLiteral The minimum bounding box.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:envelope(?x) as ?envelope)
    WHERE {
      VALUES (?x) {
        ('POLYGON ((2 0, 2 3, 3 0))'^^geo:wktLiteral) ('POLYGON ((2 0, 2 1, 3 1))')
      }
    }

    boundary

    This function returns the closure of the boundary of the specified geometry.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:boundary(geom)
    Parameter Data Type Description
    geom geomLiteral The geometry.

    Returns

    Data Type Description
    geomLiteral The closure of the boundary.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:boundary(?x) as ?boundary)
    WHERE {
      VALUES (?x) {
        ('POLYGON ((2 0, 2 3, 3 0))'^^geo:wktLiteral) ('<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)
      }
    }

    getSRID

    This function returns the spatial reference system URI for the specified geometry.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:getSRID(geom)
    Parameter Data Type Description
    geom geomLiteral The geometry.

    Returns

    Data Type Description
    URI The spatial reference system URI.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:getSRID(?x) as ?srid)
    WHERE {
      VALUES (?x) {
        ('POLYGON ((2 0, 2 3, 3 0))'^^geo:wktLiteral) ('<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)
      }
    }

    relate

    Tests whether the spatial relationship between the specified geometries relates to the specified pattern matrix. The spatial reference system for the first geometry is used for spatial calculations.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:relate(geom1, geom2, "pattern_matrix")
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.
    pattern_matrix string Represents a DE-9IM intersection pattern consisting of T (true) and F (false) values. For example, "T*F***FF*".

    Returns

    Data Type Description
    boolean True if the spatial relationship relates to the specified pattern matrix. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:relate(?x,?y,"T*F**FFF*") as ?relate)
    WHERE {
      VALUES (?x ?y) {
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>LINESTRING (2 0, 2 3)'^^geo:wktLiteral '<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)
        ('LINESTRING (0 2, 0 0, 2 0)'^^geo:wktLiteral 'LINESTRING (0 3, 0 1, 1 0, 3 0)'^^geo:wktLiteral)
      }
    }

    Simple Feature Family (Topological) Functions

    The Simple Feature Family relation functions test DE-9IM intersection patterns between two geometries. Each function tests a different pattern matrix and returns true or false depending on whether the specified relation exists or not. Multi-row intersection patterns should be interpreted as a logical OR of each row. Click a function name in the list below to view the syntax and see details about function arguments and return values.

    • sfEquals: Tests whether the specified geometries are equal.
    • sfDisjoint: Tests whether the specified geometries are disjoint.
    • sfIntersects: Tests whether the specified geometries intersect.
    • sfTouches: Tests whether the specified geometries touch.
    • sfCrosses: Tests whether the first geometry spatially crosses the second geometry.
    • sfWithin: Tests whether the first geometry is spatially within the second geometry.
    • sfContains: Tests whether the first geometry spatially contains the second geometry.
    • sfOverlaps: Tests whether the first geometry spatially overlaps the second geometry.

    sfEquals

    This function tests whether the specified geometries are equal. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TFFFTFFFT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:sfEquals(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the geometries are equal. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:sfEquals(?x,?y) as ?is_equal)
    WHERE {
      VALUES (?x ?y) {
        ('Point (2 3)' 'Point (2 3)')
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral '<gml:Point gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"> <gml:coordinates>2,3</gml:coordinates></gml:Point>'^^geo:gmlLiteral)
      }
    }

    sfDisjoint

    This function tests whether the specified geometries are disjoint. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is FF*FF****.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:sfDisjoint(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the geometries are disjoint. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:sfDisjoint(?x,?y) as ?is_disjoint)
    WHERE {
      VALUES (?x ?y) {
        ('LINESTRING (0 0, 0 1)' 'LINESTRING (1 0, 0 1)')
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>LINESTRING (1 1, 1 0)'^^geo:wktLiteral '<gml:LineString gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gml:coordinates>0,0 0,1</gml:coordinates></gml:LineString>'^^geo:gmlLiteral)
      }
    }

    sfIntersects

    This function tests whether the specified geometries intersect. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is as follows:

    T********
    *T*******
    ***T*****
    ****T****

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:sfIntersects(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the geometries intersect. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:sfIntersects(?x,?y) as ?intersects)
    WHERE {
      VALUES (?x ?y) {
        ('LINESTRING (8 7, 7 8)' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 4 1, 4 4, 1 4))'^^geo:wktLiteral '<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)
      }
    }

    sfTouches

    This function tests whether the specified geometries touch. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is as follows:

    FT*******
    F**T*****
    F***T****

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:sfTouches(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the geometries touch. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:sfTouches(?x,?y) as ?touches)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (1 2)')
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))'^^geo:wktLiteral '<gml:Point gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"> <gml:coordinates>-106.4453583,39.11775</gml:coordinates></gml:Point>'^^geo:gmlLiteral)
      }
    }

    sfCrosses

    This function tests whether the first geometry spatially crosses the second geometry. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is as follows:

    For P/L, P/A, L/A:
    T*T***T**
    For L/L:
    0*T***T**

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:sfCrosses(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the first geometry spatially crosses the second geometry. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:sfCrosses(?x,?y) as ?crosses)
    WHERE {
      VALUES (?x ?y) {
        ('LINESTRING (2 0, 2 3)' 'POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))')
        ('<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 '<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1 , 1 4, 4 4, 4 1))'^^geo:wktLiteral)
      }
    }

    sfWithin

    This function tests whether the first geometry is spatially within the second geometry. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is T*F**F***.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:sfWithin(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the first geometry is spatially within the second geometry. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:sfWithin(?x,?y) as ?is_within)
    WHERE {
      VALUES (?x ?y) {
        ('Point (-106.4453583 39.11775)' 'POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))')
        ('<gml:Point gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"> <gml:coordinates>2,3</gml:coordinates></gml:Point>'^^geo:gmlLiteral '<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral)
      }
    }

    sfContains

    This function tests whether the first geometry spatially contains the second geometry. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is T*****FF*.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:sfContains(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the first geometry spatially contains the second geometry. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:sfContains(?x,?y) as ?contains)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral 'Point (2 3)'^^geo:wktLiteral)
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral '<gml:Point gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"> <gml:coordinates>2,3</gml:coordinates></gml:Point>'^^geo:gmlLiteral)
        ('<gml:LineString gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gml:coordinates>45.67,88.56 55.56,89.44</gml:coordinates></gml:LineString>'^^geo:gmlLiteral '<gml:Point  gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"> <gml:coordinates>45.67,88.56</gml:coordinates></gml:Point>'^^geo:gmlLiteral)
      }
    }

    sfOverlaps

    This function tests whether the first geometry spatially overlaps the second geometry. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is as follows:

    For A/A, P/P:
    T*T***T**
    For L/L:
    1*T***T**

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:sfOverlaps(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the first geometry spatially overlaps the second geometry. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:sfOverlaps(?x,?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))'^^geo:wktLiteral 'POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral)
      }
    }

    Egenhofer Family (Topological) Functions

    The Egenhofer Family relation functions test DE-9IM intersection patterns between two geometries. Each function tests a different pattern matrix and returns true or false depending on whether the specified relation exists or not. Multi-row intersection patterns should be interpreted as a logical OR of each row. Click a function name in the list below to view the syntax and see details about function arguments and return values.

    • ehEquals: Tests whether the specified objects are equal.
    • ehDisjoint: Tests whether the specified objects are disjoint.
    • ehMeet: Tests whether the specified geometries meet.
    • ehOverlap: Tests whether the specified geometries overlap.
    • ehCovers: Tests whether the first geometry spatially covers the second geometry.
    • ehCoveredBy: Tests whether the first geometry is covered by the second geometry.
    • ehInside: Tests whether the first geometry is inside the second geometry.
    • ehContains: Tests whether the first geometry is contained in the second geometry.

    ehEquals

    This function tests whether the specified objects are equal based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TFFFTFFFT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ehEquals(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the objects are equal. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:ehEquals(?x,?y) as ?is_equals)
    WHERE {
      VALUES (?x ?y) {
        ('Point (2 3)' 'Point (2 3)')
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral '<gml:Point gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"> <gml:coordinates>2,3</gml:coordinates></gml:Point>'^^geo:gmlLiteral)
      }
    }

    ehDisjoint

    This function tests whether the specified objects are disjoint based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is FF*FF****.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ehDisjoint(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the objects are disjoint. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:ehDisjoint(?x,?y) as ?is_disjoint)
    WHERE {
      VALUES (?x ?y) {
        ('LINESTRING (0 0, 0 1)' 'LINESTRING (1 0, 0 1)')
        ('<http://www.opengis.net/def/crs/EPSG/0/4326> LINESTRING (1 1, 1 0)'^^geo:wktLiteral '<gml:LineString gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gml:coordinates>0,0 0,1</gml:coordinates></gml:LineString>'^^geo:gmlLiteral)
      }
    }

    ehMeet

    This function tests whether the specified geometries meet based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is as follows:

    FT*******
    F**T*****
    F***T****

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ehMeet(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the geometries meet. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:ehMeet(?x,?y) as ?meets)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (1 2)')
        ('<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))'^^geo:wktLiteral '<gml:Point gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"> <gml:coordinates>-106.4453583,39.11775</gml:coordinates></gml:Point>'^^geo:gmlLiteral)
      }
    }

    ehOverlap

    This function tests whether the specified geometries overlap based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is T*T***T**.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ehOverlap(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the geometries overlap. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:ehOverlap(?x,?y) as ?overlaps)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((2 0, 2 1, 1 3))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
        ('LINESTRING(0 0, 4 4)'^^geo:wktLiteral 'POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral)
      }
    }

    ehCovers

    This function tests whether the first geometry spatially covers the second geometry. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is T*TFT*FF*.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ehCovers(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the first geometry spatially covers the second geometry. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:ehCovers(?x,?y) as ?covers)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((2 0, 2 1, 1 3))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral 'LINESTRING(1 1, 4 4)'^^geo:wktLiteral)
        ('LINESTRING(1 1, 4 4)' 'LINESTRING(2 2, 4 4)')
        ('LINESTRING(3 3, 4 4)' 'LINESTRING(2 2, 4 4)')
      }
    }

    ehCoveredBy

    This function tests whether the first geometry is covered by the second geometry. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TFF*TFT**.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ehCoveredBy(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the first geometry is covered by the second geometry. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:ehCoveredBy(?x,?y) as ?is_covered)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((2 0, 2 1, 1 3))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
        ('LINESTRING(1 1, 4 4)' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
        ('LINESTRING(1 1, 4 4)' 'LINESTRING(2 2, 4 4)')
        ('LINESTRING(3 3, 4 4)' 'LINESTRING(2 2, 4 4)')
      }
    }

    ehInside

    This function tests whether the first geometry is inside the second geometry. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TFF*FFT**.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ehInside(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the first geometry is inside the second geometry. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:ehInside(?x,?y) as ?is_inside)
    WHERE {
      VALUES (?x ?y) {
        ('Point (-106.4453583 39.11775)' 'POLYGON ((30 10 , 40 40, 20 40, 10 20, 30 10))')
        ('<gml:Point gml:id="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"> <gml:coordinates>2,3</gml:coordinates></gml:Point>'^^geo:gmlLiteral '<http://www.opengis.net/def/crs/EPSG/0/4326>POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral)
      }
    }

    ehContains

    This function tests whether the first geometry is contained in the second geometry. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is T*TFF*FF*.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:ehContains(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the first geometry is contained in the second geometry. False if not.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:ehContains(geof:ST_GeomFromText(?x),geof:ST_GeomFromText(?y)) as ?contains)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (2 3)')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'Point (7 8)')
      }
    }

    RCC8 Family (Topological) Functions

    The RCC8 Family relation functions test DE-9IM intersection patterns between two geometries. Each function tests a different pattern matrix and returns true or false depending on whether the specified relation exists or not. Click a function name in the list below to view the syntax and see details about function arguments and return values.

    • rcc8eq: Tests whether the specified geometries are equal.
    • rcc8dc: Tests whether the specified geometries are disjoint.
    • rcc8ec: Tests whether the specified geometries are externally connected.
    • rcc8po: Tests whether the specified geometries overlap.
    • rcc8tpp: Tests whether one geometry is a tangential proper part of another geometry.
    • rcc8tppi: Tests whether one geometry is a tangential proper part inverse of another geometry.
    • rcc8ntpp: Tests whether one geometry is a non-tangential proper part of another geometry.
    • rcc8ntppi: Tests whether one geometry is a non-tangential proper part inverse of another geometry.

    rcc8eq

    This function tests whether the specified objects are equal based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TFFFTFFFT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:rcc8eq(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the objects are equal. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:rcc8eq(?x,?y) as ?is_eq)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral 'POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral)
      }
    }

    rcc8dc

    This function tests whether the specified objects are disjoint based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is FFTFFTTTT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:rcc8dc(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the objects are disjoint. False if not.

    Example

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:rcc8dc(?x,?y) as ?is_dc)
    WHERE { 
      VALUES (?x ?y) {
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((11 11, 11 14, 14 14, 14 11))')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral 'POLYGON ((1 1, 1 4, 4 4, 4 1))'^^geo:wktLiteral)
      }
    }

    rcc8ec

    This function tests whether the specified objects are externally connected based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is FFTFTTTTT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:rcc8ec(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the objects are externally connected. False if not.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:rcc8ec(?x,?y) as ?is_ec)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((4 1, 6 1, 6 4, 4 4))')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
      }
    }

    rcc8po

    This function tests whether the specified geometries overlap based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TTTTTTTTT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:rcc8po(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the geometries overlap. False if not.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:rcc8po(?x,?y) as ?is_po)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((2 0, 2 1, 1 3,1 1))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((4 1, 6 1, 6 4, 4 4))')
      }
    }

    rcc8tpp

    This function tests whether one geometry is a tangential proper part of another geometry based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TFFTTFTTT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:rcc8tpp(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the second geometry is a tangential proper part of the first geometry. False if not.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:rcc8tpp(?x,?y) as ?is_tpp)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((2 2, 5 2, 5 4, 2 4))' 'POLYGON ((1 1, 1 6, 4 1, 4 6))')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
      }
    }

    rcc8tppi

    This function tests whether one geometry is a tangential proper part inverse of another geometry based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TTTFTTFFT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:rcc8tppi(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the second geometry is a tangential proper part inverse of the first geometry. False if not.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:rcc8tppi(?x,?y) as ?is_tppi)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((2 2, 5 2, 5 4, 2 4))' 'POLYGON ((1 1, 1 6, 4 1, 4 6))')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
      }
    }

    rcc8ntpp

    This function tests whether one geometry is a non-tangential proper part of another geometry based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TFFTFFTTT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:rcc8ntpp(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the second geometry is a non-tangential proper part of the first geometry. False if not.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:rcc8ntpp(?x,?y) as ?is_ntpp)
    WHERE { 
      VALUES (?x ?y) {
        ('POLYGON ((2 2, 5 2, 5 4, 2 4))' 'POLYGON ((1 1, 1 6, 4 1, 4 6))')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
      }
    }

    rcc8ntppi

    This function tests whether one geometry is a non-tangential proper part inverse of another geometry based on their associated primary geometry objects. The spatial reference system of the first geometry is used for spatial calculations. The defining DE-9IM intersection pattern is TTTFFTFFT.

    Syntax

    PREFIX geo: <http://www.opengis.net/ont/geosparql#>
    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    geof:rcc8ntppi(geom1, geom2)
    Parameter Data Type Description
    geom1 geomLiteral The first geometry.
    geom2 geomLiteral The second geometry.

    Returns

    Data Type Description
    boolean True if the second geometry is a non-tangential proper part inverse of the first geometry. False if not.

    Example

    PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
    SELECT (geof:rcc8ntppi(?x,?y) as ?is_ntppi)
    WHERE {
      VALUES (?x ?y) {
        ('POLYGON ((2 2, 5 2, 5 4, 2 4))' 'POLYGON ((1 1, 1 6, 4 1, 4 6))')
        ('POLYGON ((1 1, 1 4, 4 4, 4 1))' 'POLYGON ((1 1, 1 4, 4 4, 4 1))')
      }
    }