Additional Geospatial Functions (Preview)

AnzoGraph offers a preview of two different packages of pre-built geospatial functions that you can use in the same way as other native, built-in analytic functions.

  • AnzoGraph GeoSPARQL functions – provides AnzoGraph support of geospatial functions following standard GeoSPARQL naming conventions and syntax compatibility (https://www.ogc.org/standards/geosparql).
  • AnzoGraphGeospatial functions – provides support of geospatial operations with an AnzoGraph package implemented using ESRI’s widely-used public domain geometry library of API functions (https://github.com/Esri/geometry-api-java/wiki).

Both sets of functions have been developed in compliance with OGC standards (https://www.ogc.org/standards).

The spatial features of AnzoGraph offer advanced capabilities to develop large scale location intelligence and geospatial applications to be used along with rich data-analytics using SPARQL/RDF. Regarding inputs of geometry data, geospatial functions can use inputs provided in the following forms:

  • WKT String geometry
  • WKTLiteral geometry
  • GMLLiteral geometry
  • CustomType geometry
Note This additional collection of Preview geospatial functions described here are subject to change based on feedback from users and, in particular, Data Science and Analytics professionals who seek improvement or changes to individual functions, their signatures, or their operation.

AnzoGraph GeoSPARQL Functions

GeoSPARQL is a world-wide geospatial standard (https://www.ogc.org/standards/geosparql/) developed and promoted by the OGC (Open Geospatial Consortium) community to represent geospatial data in RDF format, and query that data using the SPARQL query language.

This section provides a listing of the GeoSPARQL functions supported in AnzoGraph. It also provides a summary of the various geometry shape classes, subclasses, data types, properties, and relationships that GeoSPARQL supports and AnzoGraph GeoSPARQL functions can 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 of various geometries (that is, 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, ogc:wktLiteral and ogc:gmlLiteral to represent serialized geometry shapes in text form. In AnzoGraph. these literals are represented as RDFLiteral objects, which is a combination of a “text-string” and a data-type URI. All of the geometries are represented in the graph as either WKT (well-known-text format), or in GML (Geometry Markup Language) serialization forms. They may also be represented as objects or regular literal strings.
  • GeoSPARQL Relational Properties – GeoSPARQL introduces a set of properties to be used in SPARQL graph patterns. There are mainly three types of relational families - Simple Features (sf), Egenhofer (eh), and RCC8 (rcc8).
  • GeoSPARQL Functions – The GeoSPARQL specification defines a list of functions that can be used in SPARQL statements to operate on objects of type geo:Geometry.
Note The following table provides a description of the GeoSPARQL functions supported in AnzoGraph, their signatures, and return values or objects. Function arguments that specify geometries may pass those objects as wktLiteral or gmlLiteral objects, or even plain literal string values defined in the <http://www.opengis.net/> namespace. Units of geometric measurement such as kilometer, meter, mile, degree, and radian are defined in the <http://www.opengis.net/def/uom/OGC/1.0/> namespace. For more information on the operation of individual functions, see the description of the Geographic Query Language for RDF Data available at https://www.ogc.org/standards/geosparql.

For all the GeoSPARQL function signatures listed in the table, the functions reference the following namespace prefix declarations:

PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX units: <http://www.opengis.net/def/uom/OGC/1.0/>
Category/Function
Non-topological:
xsd:double geof:distance(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral, units: xsd:anyURI)

The units anyURI argument represents the unitURI in OGC format:

<http://www.opengis.net/def/uom/ogc/1.0/meter>
<http://www.opengis.net/def/uom/ogc/1.0/kilometer>

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

If no SRID is specified in geomLiteral arguments, the function will assume CRS84 as the default unit of measure and assume coordinates in Long, Lat format. If geom1 and geom2 are specified as WKT strings and no SRID details are provided, the function will compute the Euclidean distance between the two geometries regardless of what unit of measure was provided.

If you want to find the spherical distance between two geometries, you can use 4047 as the SRID, which 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.

ogc:geomLiteral geof:buffer(geom1: ogc:geomLiteral, radius: xsd:double, units: xsd:anyURI)

The units anyURI argument represents the unitURI in OGC format:

<http://www.opengis.net/def/uom/ogc/1.0/meter>
<http://www.opengis.net/def/uom/ogc/1.0/kilometer>

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

ogc:geomLiteral geof:convexHull(geom: ogc:geomLiteral)
ogc:geomLiteral geof:intersection(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
ogc:geomLiteral geof:union(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
ogc:geomLiteral geof:difference(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
ogc:geomLiteral geof:symDifference(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
ogc:geomLiteral geof:envelope(geom1: ogc:geomLiteral)
ogc:geomLiteral geof:boundary(geom1: ogc:geomLiteral)
xsd:anyURI geof:getSRID(geom: ogc:geomLiteral)

Returns the spatial reference system prefix URI, in string format, for a given geometry.

xsd:boolean geof:relate(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral, : xsd:String)
Simple Feature Family - Topological:
xsd:boolean geof:spattern-matrixfEquals(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:sfDisjoint(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:sfIntersects(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:sfTouches(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:sfCrosses(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:sfWithin(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:sfContains(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:sfOverlaps(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
Egenhofer Family - Topological:
xsd:boolean geof:ehEquals(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:ehDisjoint(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:ehMeet(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:ehOverlap(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:ehCovers(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:ehCoveredBy(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:ehInside(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:ehContains(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
RCC8 Family - Topological:
xsd:boolean geof:rcc8eq(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:rcc8dc(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:rcc8ec(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:rcc8po(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:Boolean geof:rcc8tpp(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:rcc8tppi(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:rcc8ntpp(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)
xsd:boolean geof:rcc8ntppi(geom1: ogc:geomLiteral, geom2: ogc:geomLiteral)

AnzoGraph Geospatial Functions

The AnzoGraph package of 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 which has, at a minimum, an x-coordinate and a y-coordinate.
  • MultiPoint – Ordered collection of points.

  • LineString – Shape defined by sequence of points with boundary endpoints.
  • MultiLineString – 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 – Collection of polygons, each having one or more interior polygon rings.
  • Circle Arc Polygon – Specialized circular arc polygon defined by a radius and an arc/chord length or delta angle.
  • Elliptical Arc Polygon – Specialized polygon geometry that describes some portion of an elliptical polygon.
  • Circle Polygon – Circular-shaped geometry defined by the circle's center point and its radius.
  • Ellipse Polygon – 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 respectively.
  • Rectangle Polygon – Rectangular-shaped geometry defined by its corner points and corner angles.
  • Squircle Polygon – 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 geospatial functions include the following:

  • Functions common to all shapes – Collection of functions providing operations such as conversion, translation, or conditional testing.
  • AggregatorsAnzoGraph user-defined aggregate (UDA) extensions that construct new geometric shapes from multiple aggregated geometries.
  • ServicesAnzoGraph user-defined service (UDS) extensions that extracts various geometric information from various source files such as .shp, .gml, .kml, and .json.
Important The AnzoGraph functions follow specific standards for reading and parsing particular geometry values. For GML readers and GML literal values, AnzoGraph 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 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.

AnzoGraph Geospatial Functions

The topics in this section provide details about each of the AnzoGraph geospatial functions that are available. You can click on individual function names to view the syntax of each function signature and as well as obtain details about individual function arguments and return values.

Category/Function Description
Point 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.

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. That is, it returns true if a specific line geometry is a ring geometry; otherwise, it returns false.
ST_IsRing Determines whether a given geometry is closed. That is, it returns true if a specific geometry is closed; otherwise, it returns false.
ST_MultiLineString Returns the MultiLine geometry constructed from a list of individual Line geometries.
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.
Other Geometries:
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.
Construct Geometry from GML, WKB, or WKT(and optionally WKID):
ST_GeomFromGML Returns geometry based on GML specification.
ST_GeomFromText

Constructs a text string in a well known text (WKT) representation.

ST_GeomFromWKB

Constructs a geometry from a given set of well known binary (WKB) coordinates.

The following Utility Functions are available across geometric shapes:

Function Description
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 GML representation of a geometric shape.
ST_AsWktLiteral Returns URL string from WKT representation of a given geometry.
ST_AsGmlLiteral Returns URL from GML representation of a given geometry.<http://www.w3.org/2003/01/geo/wgs84_pos#>
ST_AsWKB_HEX Returns hex string from WKB representation of a given geometry.
Logical, Comparison, and Relational Operations:
ST_Is3D Returns true if a given geometry object is three-dimensional.
ST_IsEmpty Returns true if a given geometry object is empty.
ST_IsMeasured Returns true if a given geometry object is measured.
ST_IsSimple Returns true if a given geometry object is simple.
ST_Crosses Returns true if geometry1 crosses geometry2.
ST_Contains Returns true if geometry1 contains geometry2.
ST_Disjoint Returns true if geometry1 doesn’t have any Points in common with geometry2.
ST_Equals Returns true if geometry1 equals geometry2.
ST_Intersects Returns true if geometry1 intersects geometry2.
ST_Overlaps Returns true if geometry1 overlaps geometry2.
ST_Touches Returns true if geometry1 touches geometry2.
ST_Within Returns true if geometry1 is within geometry2.
ST_EnvIntersects Returns true if the envelopes of geometry1 and geometry2 intersect.
ST_Relate Returns true 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.

The following are Aggregator (UDA) Functions:

Aggregator (UDA) Functions Description
ST_Aggr_Union Returns a union of geometries using Aggregator transformation.
ST_Aggr_LineString Returns a Line geometry constructed from a number of Point geometries using Aggregator transformation.
ST_Aggr_MultiLineString Returns a MultiLine geometry constructed from a number of line geometries using Aggregator transformation.
ST_Aggr_MultiPoint Returns a MultiPoint geometry constructed from a number of Point geometries using Aggregator transformation.
ST_Aggr_Polygon Returns a Polygon geometry constructed from a number of Point geometries using Aggregate Point geometries and Aggregator transformation.
ST_Aggr_MultiPolygon Returns a MultiPolygon geometry constructed from multiple polygon geometries using Aggregator transformation.
ST_Aggr_ConvexHull Returns a convex hull for given geometries obtained using Aggregator transformation.
ST_Aggr_Intersection Returns intersection of given geometries having same srID obtained using Aggregator transformation.

The following are Services (UDS) Functions:

Service (UDS) functions Description
ST_ReadSHP Returns geometry objects extracted from a Shapefile shape (SHP) format file.
ST_ReadKML Returns geometry objects extracted from a Keyhole Markup Language (KML) file.
ST_ReadGeoJSON Returns geometry objects extracted from a JSON format 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) format file.
ST_ReadWKB Returns geometry objects extracted from an OpenGIS Well-known Binary (WKB) file.

The following sections provided additional detail of each available geometric function as well as the syntax or signature of each function call. The description of functions specifies the W3C data types of arguments as well as the datatype of values returned by individual functions.

Data Types and Arguments

Object arguments or return types specified with functions specify transient objects internal to AnzoGraph which may contain arbitrarily long sequences of raw data bytes. Object data cannot be directly persisted or saved in a 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, as appropriate.

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 a graph store.

Note Some functions include signature arguments labelled as x, y, and z. These arguments correspond to specification of 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 geospatial functions support other coordinate systems including Spherical, Cylindrical, and Elliptical.

Representations of function signatures and arguments included in this section use braces ([arg]) to represent optional arguments. In addition, the convention, [,Object point_N]* is used to indicate when you may specify multiple arguments, 1 to N. Similarly, for functions that require an index argument entry, for example, ST_PointN, the values you may enter for the index value also range from 1 to N.

Point Functions

Click on individual function names in the table below to view the syntax of each function signature and as well as obtain details about individual function arguments and return values.

Function Description
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. The general signature for calling the ST_Point function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Point(xsd:double x, xsd:double y 
              [, xsd:double z [, xsd:double m]])

With this function, you can specify two coordinate arguments(x and y), three coordinate arguments (x, y, and z), or four coordinate arguments (x,y,z,and m).

The function returns a Custom object.

Argument Data Type Description
x xsd:double  
y xsd:double  
[z] xsd:double  
[m] xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_X function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_X(Object geom)  

The function returns a xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_SetX function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_SetX(Object geom, xsd:double x) 

The function returns a Custom object.

Argument Data Type Description
geom Object  
x xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_Y function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Y(Object geom)  

The function returns a Custom value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_SetY function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_SetY(Object geom, xsd:double y)  

The function returns a Custom object.

Argument Data Type Description
geom Object  
y xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_Z function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_Z(Object geom)  

The function returns a xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_SetZ function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_SetZ(Object geom, xsd:double z)  

The function returns a Custom object.

Argument Data Type Description
geom Object  
z xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_M function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_M(Object geom)  

The function returns a xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_SetM function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_SetM(Object geom, xsd:double m)  

The function returns a Custom object.

Argument Data Type Description
geom Object  
m xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsText(geof:ST_SetM(geof:ST_Point(1,2,3),4)) as ?point)

ST_Bin

Returns the binID of a given Point geometry. The general signature for calling the ST_Bin function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:long geof:ST_Bin(xsd:double binSize, Object geom)  

The function returns a xsd:long value.

Argument Data Type Description
binSize xsd:double  
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#Read Point from WKT shape
#Return Number of points intersections
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. With this function, you can also return the bin envelope for multiple points. The general signature for calling the ST_BinEnvelope function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_BinEnvelope(xsd:double binSize, Object geom)  

The function returns a Custom object.

Argument Data Type Description
binSize xsd:double  
geom Object  

Example Query:

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. The general signature for calling the ST_MultiPoint function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_MultiPoint((xsd:double x, xsd:double y)[,xsd:double xx, 
                          xsd:double yy])  

The function returns a Custom object.

Argument Data Type Description
x xsd:double  
y xsd:double  
[xx] xsd:double  
[yy] xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_PointN function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_PointN(Object geom, xsd:int index)

The function returns a Custom object.

Argument Data Type Description
geom Object  
index xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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

Click on individual function names in the table below to view the syntax of each function signature and as well as obtain details about individual function arguments and return values.

Function Description
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. That is, it returns true if a specific line geometry is a ring geometry; otherwise, it returns false.
ST_IsRing Determines whether a given geometry is closed. That is, it returns true if a specific geometry is closed; otherwise, it returns false.
ST_MultiLineString Returns the MultiLine geometry constructed from a list of individual Line geometries.

 

ST_LineString

Returns a LineString as a custom object constructed from a number of individual point geometries. The general signature for calling the ST_LineString function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_LineString(Object point1 [,Object point_N]*)  

The function returns a Custom object.

Argument Data Type Description
point1 ...
[, point_N]*
Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_StartPoint function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_StartPoint(Object line)  

The function returns a Custom object.

Argument Data Type Description
line Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#Find line string start and point with maximum points
#Return start and end points in text format
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. The general signature for calling the ST_EndPoint function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_EndPoint(Object line)  

The function returns a Custom object.

Argument Data Type Description
line Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#Find line string start and point with maximum points
#Return start and end points in text format
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. That is, it returns true if a specific geometry is closed; otherwise, it returns false. The general signature for calling the ST_IsClosed function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_IsClosed(Object line)  

The function returns a xsd:boolean value.

Argument Data Type Description
line Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#Check wither line string is closed or not
#Return Boolean whether line string is closed or not
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. That is, it returns true if a specific line geometry is a ring geometry; otherwise, it returns false. The general signature for calling the ST_IsRing function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_IsRing(Object line)  

The function returns an xsd:boolean value.

Argument Data Type Description
line Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#Check wither line string is ring or not
#Return Boolean whether line string is ring or not
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. The general signature for calling the ST_MultiLineString function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_MultiLineString(Object line1 [, Object line_N]*)  

The function returns a Custom object.

Argument Data Type Description
line1 ...
[, line_N]*
Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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

Click on individual function names in the table below to view the syntax of each function signature and as well as obtain details about individual function arguments and return values.

Function Description
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.
Other Geometries:
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.
Construct Geometry from GML, WKB, or WKT(and optionally WKID):
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. The general signature for calling the ST_Polygon function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Polygon(Object point1 [,Object point_N]*)

The function returns a Custom object.

Argument Data Type Description
point1 ...
[, pointN]*
Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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 exterior ring of a given polygon geometry. The general signature for calling the ST_ExteriorRing function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_ExteriorRing(Object polygon)

The function returns a Custom object.

Argument Data Type Description
polygon Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_NumInteriorRing function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:int geof:ST_NumInteriorRing(Object polygon) 

The function returns an xsd:int value.

Argument Data Type Description
polygon Object  

Example Query:

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. The general signature for calling the ST_InteriorRingN function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_InteriorRingN(Object polygon, xsd:int n)  

The function returns a Custom object.

Argument Data Type Description
polygon Object  
n xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_MultiPolygon function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_MultiPolygon(Object polygon1 [,Object polygon_N]*)  

The function returns a Custom object.

Argument Data Type Description
polygon1 ...
[, polygon_N]*
Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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

Return Circle Polygon from given radius and point geometry. The general signature for calling the ST_Circle function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Circle(Object geom, xsd:double radius, xsd:int numOfPoints)

The function returns a Custom object.

Argument Data Type Description
geom Object  
radius xsd:double  
numOfPoints xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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, x and y coordinates. The general signature for calling the ST_CircleArc function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_CircleArc(Object geom, xsd:double radius, xsd:int numOfPoints)

The function returns a Custom object.

Argument Data Type Description
geom Object  
radius xsd:double  
numOfPoints xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsText(geof:ST_CircleArc((geof:ST_Point(1,2)),5,10,3,10)) as ?circle_arc_polygon)

ST_Arc

Returns Arc from a given start angle and size angle. The general signature for calling the ST_Arc function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Arc(xsd:double x, xsd:double y, xsd:double radius, 
              xsd:double startRad, xsd:double sizeRad, 
              xsd:int numOfPoints)

The function returns a Custom object.

Argument Data Type Description
x

xsd:double

 
y xsd:double  
radius xsd:double  
startRad xsd:double  
sizeRad xsd:double  
numOfPoints xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsText(geof:ST_Arc(1,2,5,10,20,4)) as ?Arc)

ST_Ellipse

Return an Ellipse Polygon from a given radius and point geometry. The general signature for calling the ST_Ellipse function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Ellipse(Object center_pt, xsd:double xRadius, 
                 xsd:double yRadius, xsd:int numOfPoints)

The function returns a Custom object.

Argument Data Type Description
center_pt Object  
xRadius xsd:double  
yRadius xsd:double  
numOfPoints xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsText(geof:ST_Ellipse((geof:ST_Point(1,2)),2,3,10)) as ?ellipse_polygon)

ST_EllipticalArc

Returns Elliptical Arc Polygon from given radius and point geometry. The general signature for calling the ST_EllipseArc function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_EllipseArc(Object geom, xsd:double radius, xsd:int numOfPoints)

The function returns a Custom object.

Argument Data Type Description
geom Object  
radius xsd:double  
numOfPoints xsd:int  

Example Query:

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.The general signature for calling the ST_Rectangle function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Rectangle(Object geom, xsd:double width, 
                   xsd:double height, xsd:int numOfPoints)

The function returns a Custom object.

Argument Data Type Description
geom Object  
width xsd:double  
height xsd:double  
numOfPoints xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_Squircle function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Squircle(Object geom, xsd:double radius, xsd:int numOfPoints)

The function returns a Custom object.

Argument Data Type Description
geom Object  
radius xsd:double  
numOfPoints xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsText(geof:ST_Squircle((geof:ST_Point(1,2)),3,10)) as ?squircle_polygon)

ST_GeomFromGML

Returns geometry based on GML specification. The general signature for calling the ST_GeomFromGML function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_GeomFromGML(xsd:string gml)  

The function returns a Custom object.

Argument Data Type Description
gml xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_GeomFromText function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_GeomFromText(xsd:string wkt [, xsd:int SRID] )  

A wkt string is passed as the first function input. You may optionally specify a second SRID argument. (By default, the SRID value is 0.)

The function returns a Custom object.

Argument Data Type Description
wkt xsd:string  
[SRID] xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_GeomFromWKB function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_GeomFromWKB(xsd:string wkb_hexstr [, xsd:int wkid] )  

A wkt string is passed as the first function input. You may optionally specify a second wkid argument. (By default, the wkid value is 0.)

The function returns a Custom object.

Argument Data Type Description
wkb_hexstr xsd:string  
[wkid] xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsText(geof:ST_GeomFromWKB(?val)) as ?geom)
where {
  values (?val) {('000000000140000000000000004010000000000000')}
}

Utility Functions

Click on individual function names in the table below to view the syntax of each function signature and as well as obtain details about individual function arguments and return values.

Function Description
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 GML representation of geometric shape.
ST_AsWktLiteral Returns URL from WKT representation of a given geometry.
ST_AsGmlLiteral Returns URL from GML representation of a given geometry.
ST_AsWKB_HEX Returns hex string from WKB representation of a given geometry.
Logical, Comparison, and Relational Operations:
ST_Is3D Returns true if a given geometry object is three-dimensional.
ST_IsEmpty Returns true if a given geometry object is empty.
ST_IsMeasured Returns true if a given geometry object is measured.
ST_IsSimple Returns true if a given geometry object is simple.
ST_Crosses Returns true if geometry1 crosses geometry2.
ST_Contains Returns true if geometry1 contains geometry2.
ST_Disjoint Returns true if geometry1 doesn’t have any Points in common with geometry2.
ST_Equals Returns true if geometry1 equals geometry2.
ST_Intersects Returns true if geometry1 intersects geometry2.
ST_Overlaps Returns true if geometry1 overlaps geometry2.
ST_Touches Returns true if geometry1 touches geometry2.
ST_Within Returns true if geometry1 is within geometry2.
ST_EnvIntersects Returns true if the envelopes of geometry1 and geometry2 intersect.
ST_Relate Returns true 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 X coordinate for a given geometry. The general signature for calling the ST_MinX function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_MinX(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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 X coordinate for a given geometry. The general signature for calling the ST_MaxX function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_MaxX(Object geom)

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#validate ymax, ymin, xmax, xmin of shape
#Return points, ymax, ymin, xmax, xmin
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 Y coordinate for a given geometry. The general signature for calling the ST_MinY function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_MinY(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>

#validate ymax, ymin, xmax, xmin of shape
#Return points, ymax, ymin, xmax, xmin
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 Y coordinate for a given geometry. The general signature for calling the ST_MaxY function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_MaxY(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>

#validate ymax, ymin, xmax, xmin of shape
#Return points, ymax, ymin, xmax, xmin
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 Z coordinate for a given geometry. The general signature for calling the ST_MinZ function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_MinZ(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

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 Z coordinate for a given geometry. The general signature for calling the ST_MaxZ function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_MaxZ(Object geom)  

The function return an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_MinM function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_MinM(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_MaxM function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_MaxM(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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 GeoJSON representation of any geometric shape. The general signature for calling the ST_AsGeoJSON function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:string geof:ST_AsGeoJSON(Object geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_IsValidGeoJSON(geof:ST_AsGeoJSON(geof:ST_GeomFromText('LINESTRING(4 6,7 10)'))) as ?is_valid_geojson)

ST_AsJSON

Returns JSON representation of any geometric shape. The general signature for calling the ST_AsJSON function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:string geof:ST_AsJSON(Object geom)

The function returns an xsd:string value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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. The general signature for calling the ST_AsBinary function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_AsBinary(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
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 well known text (WKT) representation of any geometric shape. The general signature for calling the ST_AsText function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:string geof:ST_AsText(Object geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsText(geof:ST_Circle((geof:ST_Point(1,2)),3,10)) as ?circle_polygon)

ST_AsGML

Returns geometry from GML representation of geometric shape. The general signature for calling the ST_AsGML function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:string geof:ST_AsGML(Object geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsGML(geof:ST_Point(1.1,-6.7)) as ?point)

ST_AsWktLiteral

Returns URL from well known text (WKT) representation of a geometric shape. The general signature for calling the ST_AsWktLiteral function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
Custom geo:ST_AsWktLiteral(Object geom)  

The function returns a Custom value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema
select (geof:sfContains(?x,geof:ST_AsWktLiteral(geof:ST_GeomFromText(?y))) as ?is_contains)
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 URL from GML representation of a geometric shape. The general signature for calling the ST_AsGmlLiteral function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
Custom geo:ST_AsGmlLiteral(Object geom)

The function returns a gCustom value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:sfContains(?x,geof:ST_AsGmlLiteral(?y)) as ?is_contains)
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 hex string from WKB representation of a given geometry. The general signature for calling the ST_AsWKB_HEX function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:string geof:ST_AsWKB_HEX(Object geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
select (geof:ST_AsWKB_HEX(geof:ST_GeomFromText(?x)) as ?is_contains)
where {
   values (?x) {
     ('POLYGON ((2 0, 2 1, 3 1))')
   }
}

ST_Is3D

Returns true if a given geometry object is three-dimensional. The general signature for calling the ST_Is3D function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Is3D(Object geom)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#Return: boolean value indicating whether point is 3D or not
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

Returns true if a given geometry object is empty. The general signature for calling the ST_IsEmpty function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_IsEmpty(Object geom)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
select (geof:ST_IsEmpty(geof:ST_GeomFromText(?x)) as ?empty)
where {
   values (?x) {('point empty')}
}

ST_IsMeasured

Returns true if a given geometry object is measured. The general signature for calling the ST_IsMeasured function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_IsMeasured(Object geom)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Check whether shape is measured or not
#Return Boolean whether shape is measured or not
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

Returns true if a given geometry object is simple. The general signature for calling the ST_IsSimple function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_IsSimple(Object geom)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Check whether line string is simple or not
#Return Boolean whether line string is simple or not
select (geof:ST_IsSimple(geof:ST_Point(?x, ?y)) as ?simple)
where { values (?x ?y) {(2 3) (-1000 -234234)}
}

ST_Crosses

Returns true if geometry1 crosses geometry2. The general signature for calling the ST_Crosses function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Crosses(Object geom1, Object geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if geometry1 contains geometry2. The general signature for calling the ST_Contains function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Contains(Object geom1, Object geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if geometry1 doesn’t have any Points in common with geometry2. The general signature for calling the ST_Disjoint function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Disjoint(Object geom1, Object geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if geometry1 equals geometry2. The general signature for calling the ST_Equals function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Equals(Object geom1, Object geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if geometry1 intersects geometry2. The general signature for calling the ST_Intersects function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Intersects(Object geom1, Object geom2) 

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if geometry1 overlaps geometry2. The general signature for calling the ST_Overlaps function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Overlaps(Object geom1, Object geom2)

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if geometry1 touches geometry2. The general signature for calling the ST_Touches function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Touches(Object geom1, Object geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if geometry1 is within geometry2. The general signature for calling the ST_Within function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Within(Object geom1, Object geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if the envelopes of geometry1 and geometry2 intersect. The general signature for calling the ST_EnvIntersects function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_EnvIntersects(Object geom1, Object geom2)  

The function return an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns true if geometry1 has the specified DE-9IM relationship with geometry2. The general signature for calling the ST_Relate function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_Relate(Object geom1, Object geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Distance function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_Distance(Object geom1, Object geom2 
  [,xsd:URI units [,boolean isSpherical]])  
Note

The third and fourth function arguments are optional. The third argument indicates the unit of distance in which output can be expected. The fourth argument returns a true or false boolean value that indicates whether specified geometries are spherical or not.

The setting of the isSpherical flag allows the ST_Distance function to explicitly control computation of the shortest spherical distance between two geometries. If set to a boolean True value, the function computes the shortest spherical distance between the two geometries only using geom1 SRID to detect axis order and the function will perform spherical calculation based on the Earth mean radius (6,371,008.7714).

The function returns an xsd:double value.

Argument Data Type Description
geom1 Object  
geom2 Object  
unitsI xsd:URI  
isSpherical boolean  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Boundary function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Boundary(Object geom)  

The function returns: a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Intersection function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Intersection(Object geom1, Object geom2)  

The function returns a Custom object.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Difference function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Difference(Object geom1, Object geom2)  

The function returns a Custom object.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_SymDifference function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_SymDifference(Object geom1, Object geom2)  

The function returns a Custom object.

Argument Data Type Description
geom1 Object  
geom2 Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_SRID function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:int geof:ST_SRID(Object geom)  

The function returns an xsd:int value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_SetSRID function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_SetSRID(Object geom, xsd:int wkid)  

The function returns a Custom object.

Argument Data Type Description
geom Object  
wkid xsd:int  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Dimension function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:int geof:ST_Dimension(Object geom)  

The function returns an xsd:int value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Length function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_Length(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Area function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_Area(Object geom)  

The function returns the area of a geometry as an xsd:double value.

Argument Data Type Description
geom Object  

The function returns the planar area if a geometry is passed without an SRID. The function returns the geodesic area if a geometry is passed with SRID 4326 /CRS84 and returns the spherial area if a geometry is passed with SRID 4047.

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_CoordDim function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_CoordDim(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Envelope function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Envelope(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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.The general signature for calling the ST_GeometryType function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:string geof:ST_GeometryType(Object geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Union function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Union(Object geom1 [,Object geom_N]*)  

The function returns a Custom object.

Argument Data Type Description
geom1 ...
[, geom_N]*
Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>#
#
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. The general signature for calling the ST_NumPoints function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:int geof:ST_NumPoints(Object geom)  

The function returns an xsd:int value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_NumGeometries function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:int geof:ST_NumGeometries(Object geom)  

The function returns an xsd:int value.

Argument Data Type Description
geom Object  

Example Query:

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. The general signature for calling the ST_GeometryN function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_GeometryN(Object geom, xsd:int index)  

The function returns a Custom object.

Argument Data Type Description
geom Object  
index xsd:int  

Example Query:

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. The general signature for calling the ST_Centroid function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Centroid(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Buffer function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Buffer(Object geom, xsd:double distance)  

The function returns a Custom object.

Argument Data Type Description
geom Object  
distance xsd:double  

Example Query:

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. The general signature for calling the ST_ConvexHull function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_ConvexHull(Object geom1 [,Object geom_N]*)  

The function returns a Custom object.

Argument Data Type Description
geom1 ...
[, geom_N]*
Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_GeodesicLengthWGS84 function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_GeodesicLengthWGS84(Object geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_GeomFromJSON function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_GeomFromJSON(xsd:string json)  

The function returns a Custom object.

Argument Data Type Description
json xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_GeomFromGeoJSON function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_GeomFromGeoJSON(xsd:string geojson)  

The function returns a Custom object.

Argument Data Type Description
geojson xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_LatLonFromDMSToDD function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:double geof:ST_LatLonFromDMSToDD(xsd:double degrees, xsd:double minutes, 
                          xsd:double seconds, xsd:URI direction)

Here direction represents one of the following string constants: geo:E ,geo:W, geo:N, or geo:S.

The function returns an xsd:double object.

Argument Data Type Description
degrees xsd:double  
minutes xsd:double  
seconds xsd:double  
direction xsd:URI  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
select (geof:ST_LatLonFromDMSToDD(137,24,13,geof:S) as ?longitude_decimal_degree)

ST_GeomFromWktLiteral

Returns a Custom object from a WKT literal string. The general signature for calling the ST_GeomFromWktLiteral function is the following:

PREFIX geo: <http://www.../>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_GeomFromWktLiteral(geo:wktLiteral)  

The function returns a Custom object.

Argument Data Type Description
  geo:wktLiteral  

Example Query:

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 a Custom object from a GML literal string. The general signature for calling the ST_GeomFromGmlLiteral function is the following:

PREFIX geo: <http://www.../>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_GeomFromGmlLiteral(geo:wktLiteral)  

The function returns an Custom object.

Argument Data Type Description
  geo:wktLiteral  

Example Query:

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. The general signature for calling the ST_ConvertCoordinates function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:string geof:ST_ConvertCoordinates(xsd:double x, xsd:double y, 
                       xsd:double z, xsd:URI sourceSys, xsd:URI destSys)  

SourceSys and destSys arguments are string constants indicating source and destination coordinate systems. The sourceSys and destSys arguments can be passed as constants such as geo:CARTESIAN, geo:SPHERICAL, geo:CYLINDRICAL, and geo:ELLIPTICAL.

The meaning of the first three inputs depends on the 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

The function returns an xsd:string object.

Argument Data Type Description
x xsd:double  
y xsd:double  
z xsd:double  
sourceSys xsd:URI  
destSys xsd:URI  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
select (geof:ST_ConvertCoordinates(2,3,8,geof:CARTESIAN,geof:SPHERICAL) as ?transformed_point)

ST_IsValidWKT

Returns equivalent spherical coordinates for given cylindrical coordinates. The general signature for calling the ST_IsValidWKT function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_IsValidWKT(xsd:string wkt)

The function returns an xsd:boolean object.

Argument Data Type Description
wkt xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
select (geof:ST_IsValidWKT('LINESTRING(4 6,7 10)') as ?is_valid_wkt)

ST_IsValidGeoJSON

Validates whether a given geoJSON representation is correct. Returns true if it is a valid geoJSON format, otherwise returns false. The general signature for calling the ST_IsValidGeoJSON function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
xsd:boolean geof:ST_IsValidGeoJSON(xsd:string geojson)

The function returns an xsd:boolean value.

Argument Data Type Description
geojson xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
select (geof:ST_IsValidGeoJSON(geof:ST_AsGeoJSON(geof:ST_GeomFromText('LINESTRING(4 6,7 10)'))) as ?is_valid_geojson)

ST_Translate

Transform a geometry with given shift values. The general signature for calling the ST_Translate function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Translate(Object geom, xsd:double x_delta, 
                   xsd:double y_delta [, xsd:double z_delta])  

The first input argument is a geometric shape in Object format that represents any of the geometries to be transformed. Users can then pass shift values for x, y, and z coordinates. For 2D translations, users would pass x_delta and y_delta arguments, and the z_delta argument would be optional.

The function returns a Custom object.

Argument Data Type Description
geom Object  
x_delta xsd:double  
y_delta xsd:double  
[z_delta] xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Scale function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Scale(Object geom, xsd:double x_sf, xsd:double y_sf 
               [, xsd:double z_sf])  

The first input argument is a geometric shape in Object format that represents the geometry to be scaled: point, multipoint, line, multiline, polygon, or multipolygon. Users can then pass scaling values

for x, y, and z coordinates. For 2D scaling, users would pass x_delta and y_delta arguments, and the z_delta argument would be optional. The function returns a Custom object.

Argument Data Type Description
geom Object  
x_sf xsd:double  
y_sf xsd:double  
[z_sf] xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Shear function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Shear(Object geom, double x_shear, double y_shear 
               [, double z_shear])  

The first input argument is a geometric shape in Object format that represents the geometry to be sheared: point, multipoint, line, multiline, polygon, or multipolygon. The second input is the axis which represents the X/Y/Z axis , the axis along which shearing is to be done. Value can be passed as string constants like geo:X or geo:Y or geo:Z . Users can pass the shearing factor for x,y,z coordinates, and should be passed in X, Y, and Z order respectively. (The z_shear argument is optional in this case.) The function returns a Custom object.

Argument Data Type Description
geom Object  
x_shear xsd:double  
y_shear xsd:double  
[z_shear] xsd:double  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_Rotate function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
Custom geof:ST_Rotate(Object geom, xsd:double angle_rads, xsd:URI axis)  

The first input argument is a geometric shape in Object format that represents the geometry to be rotated: point, multipoint, line, multiline, polygon, or multipolygon. The second input argument is the angle in radians that represnts the rotational angle in radians. The third input argument is the axis on which a 2d or 3d rotation is performed, so the axis value input represent the X, Y, or Z axis, based on the axis on which rotation is to be done. Its value can be passed as a String constant like geo:X, geo:Y, or geo:Z. The function returns a Custom object.

Argument Data Type Description
geom Object  
angle_rads xsd:double  
axis xsd:URI  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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 on individual function names in the table below to view the syntax of each function signature and as well as obtain details about individual function arguments and return values.

Function Description
ST_Aggr_Union Returns union of geometries using Aggregator transformation.
ST_Aggr_LineString Returns Line geometry constructed from a number of Point geometries using Aggregator transformation.
ST_Aggr_MultiLineString Returns MultiLine geometry constructed from a number of line geometries using Aggregator transformation.
ST_Aggr_MultiPoint Returns MultiPoint geometry constructed from a number of Point geometries using Aggregator transformation.
ST_Aggr_Polygon Returns Polygon geometry constructed from a number of Point geometries using Aggregate Point geometries and Aggregator transformation.
ST_Aggr_MultiPolygon Returns MultiPolygon geometry constructed from multiple polygon geometries using Aggregator transformation.
ST_Aggr_ConvexHull Returns convex hull for given geometries obtained using Aggregator transformation.
ST_Aggr_Intersection Returns intersection of given geometries having same srID obtained using Aggregator transformation.

ST_Aggr_Union

Returns union of geometries using Aggregator transformation. The general signature for calling the ST_Aggr_Union function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Aggr_Union(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns Line geometry constructed from a number of Point geometries using Aggregator transformation. The general signature for calling the ST_Aggr_LineString function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Aggr_LineString(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns MultiLine geometry constructed from a number of line geometries using Aggregator transformation. The general signature for calling the ST_Aggr_MultiLineString function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Aggr_MultiLineString(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns MultiPoint geometry constructed from a number of Point geometries using Aggregator transformation. The general signature for calling the ST_Aggr_MultiPoint function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Aggr_MultiPoint(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns Polygon geometry constructed from a number of Point geometries using Aggregate Point geometries and Aggregator transformation. The general signature for calling the ST_Aggr_Polygon function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Aggr_Polygon(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns MultiPolygon geometry constructed from multiple polygon geometries using Aggregator transformation. The general signature for calling the ST_Aggr_MultiPolygon function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Aggr_MultiPolygon(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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

Returns convex hull for given geometries obtained using Aggregator transformation. The general signature for calling the ST_Aggr_ConvexHull function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Aggr_ConvexHull(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Return Number of points of convex hull
#
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 intersection of given geometries having same srID. The general signature for calling the ST_Aggr_Intersection function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_Aggr_Intersection(Object geom)  

The function returns a Custom object.

Argument Data Type Description
geom Object  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Read Point from WKT shape
#Return Number of points intersections
#
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 on individual function names in the table below to view the syntax of each function signature and as well as obtain details about individual function arguments and return values.

Function Description
ST_ReadSHP Returns geometry objects extracted from a Shapefile shape (SHP) format file.
ST_ReadKML Returns geometry objects extracted from a Keyhole Markup Language (KML) file.
ST_ReadGeoJSON Returns geometry objects extracted from a JSON format 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) format 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. The general signature for calling the read_shape function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_ReadSHP(xsd:string filePath)  

The function returns a Custom object.

Argument Data Type Description
filePath xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Create query to read Line Strings from shape File
#Return line string objects and corresponding ID
#
CREATE OR REPLACE QUERY <line_table> AS
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. The general signature for calling the ST_ReadKML function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_ReadKML(xsd:string filePath)  

The function returns a Custom object.

Argument Data Type Description
filePath xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_ReadGeoJSON function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_ReadGeoJSON(xsd:string filePath)  

The function returns a Custom object.

Argument Data Type Description
filePath xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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. The general signature for calling the ST_ReadText function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_ReadText(xsd:string filePath)  

The function returns a Custom object.

Argument Data Type Description
filePath xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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 .json file. The general signature for calling the ST_ReadGML function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_ReadGML(xsd:string filePath)  

The function returns a Custom object.

Argument Data Type Description
filePath xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
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 .json file. The general signature for calling the ST_ReadWKB function is the following:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
Custom geof:ST_ReadWKB(xsd:string filePath)  

The function returns a Custom object.

Argument Data Type Description
filePath xsd:string  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
SELECT * WHERE{   
  SERVICE <http://www.opengis.net/def/function/geosparql/ST_ReadWKB>('{CURRENT_DIR}/../data/single_geometryWkb.wkb') {} 
}