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).
  • AnzoGraph Geospatial 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.

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 Blob 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, Blobs, 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_GeomFromCollectionText Returns geometry objects from a WKT collection file.
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

Blob arguments or return types specified with functions specify transient objects internal to AnzoGraph which may contain arbitrarily long sequences of raw data bytes. Blob data cannot be directly persisted or saved in a graph store, however, a Blob (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 Blob handle cannot exceed one query. A Blob 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, [,Blob 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 blob 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#>
Blob 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 Blob 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#>
#Usage: geof:ST_Point(?x, ?y, ?z, ?m)
# x - point x coordinate
# y - point y coordinate
# z - point z coordinate
# m - point m coordinate
#Return: Point shape in binary format(BLOB)
#
#*****************************************************************************
#
#Read Point from WKT shape whose object id=100
#Return Blob object into text format
select (geof:ST_AsText(geof:ST_Point(?point_x, ?point_y, ?point_z, ?point_m)) as ?result)
from <point>
where{
  ?point a <http://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  <http://anzograph.com/geologic_units_24k/id> "100"^^xsd:long.
  BIND(geof:ST_GeomFromText(?shape,0) 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)
}
#POINT ZM (-122.05045797533386 47.550270129490144 25 30)

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(Blob geom)  

The function returns a xsd:double value.

Argument Data Type Description
geom Blob  

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 Blob object into max x coordinate
select (max(geof:ST_X(geof:ST_Point(?point_x, ?point_y, ?point_z, ?point_m))) as ?result)
from <point>
where{
  ?point a <http://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,0) 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)
}
#0.000000

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#>
Blob geof:ST_SetX(Blob geom, xsd:double x) 

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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#>
xsd:double geof:ST_Y(Blob geom)  

The function returns a xsd:double value.

Argument Data Type Description
geom Blob  

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 Blob object into max y coordinate
#
select (max(geof:ST_Y(geof:ST_Point(?point_x, ?point_y, ?point_z, ?point_m))) as ?result)
from <point>
where{
  ?point a <http://anzograph.com/geologic_units_24k/point>;  
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,0) 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)
}
#48.995800

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#>
Blob geof:ST_SetY(Blob geom, xsd:double y)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  
y 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_SetY(geof:ST_Point(1,2),4)) as ?point)
#

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(Blob geom)  

The function returns a xsd:double value.

Argument Data Type Description
geom Blob  

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 Blob object into max z coordinate
select (max(geof:ST_Z(geof:ST_Point(?point_x, ?point_y, ?point_z, ?point_m))) as ?result)
from <point>
where{
  ?point a <http://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,0) 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)
}
#25.000000

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#>
Blob geof:ST_SetZ(Blob geom, xsd:double z)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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(Blob geom)  

The function returns a xsd:double value.

Argument Data Type Description
geom Blob  

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 Blob object into max m coordinate
#
select (min(geof:ST_M(geof:ST_Point(?point_x, ?point_y, ?point_z, ?point_m))) as ?result)
from <point>
where{
  ?point a <http://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,0) 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)
}
#30.000000

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#>
Blob geof:ST_SetM(Blob geom, xsd:double m)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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, Blob geom)  

The function returns a xsd:long value.

Argument Data Type Description
binSize xsd:double  
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Example-1
#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://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  <http://anzograph.com/geologic_units_24k/id> "0"^^xsd:long.
  BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
}
#Ans
#46116858818351012
#

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#>
Blob geof:ST_BinEnvelope(xsd:double binSize, Blob geom)  

The function returns a Blob object.

Argument Data Type Description
binSize xsd:double  
geom Blob  

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://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  <http://anzograph.com/geologic_units_24k/id> "0"^^xsd:long.  
BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
}
#Ans
#POLYGON ((-122.11508989334106 37.548681020736694, -112.11508989334106 37.548681020736694, -112.11508989334106 47.548681020736694, -122.11508989334106 47.548681020736694, -122.11508989334106 37.548681020736694))
#

ST_MultiPoint

Returns a MultiPoint as a blob 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#>
Blob geof:ST_MultiPoint((xsd:double x, xsd:double y)[,xsd:double xx, 
                          xsd:double yy])  

The function returns a Blob 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#>
Blob geof:ST_PointN(Blob geom, xsd:int index)

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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,0) , 2)) as ?envelope)
where {
  values (?x) {('LINESTRING (0 0, 2 2)') ('LINESTRING (8 7, 7 8)')}
}

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 blob 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#>
Blob geof:ST_LineString(Blob point1 [,Blob point_N]*)  

The function returns a Blob object.

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

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,0),geof:ST_GeomFromText(?pt2,0))) 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#>
Blob geof:ST_StartPoint(Blob line)  

The function returns a Blob object.

Argument Data Type Description
line Blob  

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,0))) as ?start_point) (geof:ST_AsGeoJSON(geof:ST_EndPoint(geof:ST_GeomFromText(?line_str_wkt,0))) as ?end_point)
from <linestring>
where {
  ?ln_str_ins a <http://anzograph.com/road_centerline/linestring>;
  <http://anzograph.com/road_centerline/shape> ?line_str_wkt;
  <http://anzograph.com/road_centerline/no_of_points> ?no_pt_ln.
}
order by desc(?no_pt_ln) desc(?line_str_wkt)
limit 1
#ans
#"{""type"":""Point"",""coordinates"":[-81.67550116933592,25.9327826450007],""crs"":null}","{""type"":""Point"",""coordinates"":[-81.67487609919125,25.908344432643958],""crs"":null}"
#

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#>
Blob geof:ST_EndPoint(Blob line)  

The function returns a Blob object.

Argument Data Type Description
line Blob  

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,0))) as ?start_point) (geof:ST_AsGeoJSON(geof:ST_EndPoint(geof:ST_GeomFromText(?line_str_wkt,0))) as ?end_point)
from <linestring>
where {
  ?ln_str_ins a <http://anzograph.com/road_centerline/linestring>;
  <http://anzograph.com/road_centerline/shape> ?line_str_wkt;
  <http://anzograph.com/road_centerline/no_of_points> ?no_pt_ln.
}
order by desc(?no_pt_ln) desc(?line_str_wkt)
limit 1
#ans
#"{""type"":""Point"",""coordinates"":[-81.67550116933592,25.9327826450007],""crs"":null}","{""type"":""Point"",""coordinates"":[-81.67487609919125,25.908344432643958],""crs"":null}"
#

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(Blob line)  

The function returns a xsd:boolean value.

Argument Data Type Description
line Blob  

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,0)) 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(Blob line)  

The function returns an xsd:boolean value.

Argument Data Type Description
line Blob  

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#>
Blob geof:ST_MultiLineString(Blob line1 [, Blob line_N]*)  

The function returns a Blob object.

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

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,0),geof:ST_GeomFromText(?l2,0))) 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#>
Blob geof:ST_Polygon(Blob point1 [,Blob point_N]*)

The function returns a Blob object.

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

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,?z),geof:ST_Point(?x1,?y1,?z1),geof:ST_Point(?x2,?y2,?z2))) as ?line_from_points)
where{
  values (?x ?y ?z ?x1 ?y1 ?z1 ?x2 ?y2 ?z2) {(1.1 7.0 3.2 2 3 1 5 -6.7 -3.2) (-2 3.4 -1 -7.8 9.3 2.1 5.4 -1.0 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#>
Blob geof:ST_ExteriorRing(Blob polygon)

The function returns a Blob object.

Argument Data Type Description
polygon Blob  

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(geof:ST_GeomFromText(?x,0))) 
  as ?exteriorRing)
where {
  values(?x) {('POLYGON((1 1, 1 4, 4 4, 4 1),(4 1, 10 1, 10 2, 4 2))') ('POLYGON((2 2, 6 4, 6 10, -2 10, -2 4, 2 2),(1 5, 3 5, 3 7, 1 7))')}
}

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(Blob polygon) 

The function returns an xsd:int value.

Argument Data Type Description
polygon Blob  

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,0)) as ?polygon)
from <polygon>
where {
  ?multi_pt a <http://anzograph.com/national_weather_service_wind_gust_forecast/polygon>;
  <http://anzograph.com/national_weather_service_wind_gust_forecast/shape> ?multi_pt_wkt;
  <http://anzograph.com/national_weather_service_wind_gust_forecast/id> "0"^^xsd:int.
}
#Ans
#0

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#>
Blob geof:ST_InteriorRingN(Blob polygon, xsd:int n)  

The function returns a Blob object.

Argument Data Type Description
polygon Blob  
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,0),0)) 
  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#>
Blob geof:ST_MultiPolygon(Blob polygon1 [,Blob polygon_N]*)  

The function returns a Blob object.

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

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,0),geof:ST_GeomFromText(?p2,0))) 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#>
Blob geof:ST_Circle(Blob geom, xsd:double radius, xsd:int numOfPoints)

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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#>
Blob geof:ST_CircleArc(Blob geom, xsd:double radius, xsd:int numOfPoints)

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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#>
Blob 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 Blob 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#>
Blob geof:ST_Ellipse(Blob center_pt, xsd:double xRadius, 
                 xsd:double yRadius, xsd:int numOfPoints)

The function returns a Blob object.

Argument Data Type Description
center_pt Blob  
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#>
Blob geof:ST_EllipseArc(Blob geom, xsd:double radius, xsd:int numOfPoints)

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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#>
Blob geof:ST_Rectangle(Blob geom, xsd:double width, 
                   xsd:double height, xsd:int numOfPoints)

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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#>
Blob geof:ST_Squircle(Blob geom, xsd:double radius, xsd:int numOfPoints)

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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#>
Blob geof:ST_GeomFromGML(xsd:string gml)  

The function returns a Blob 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)',0)))) as ?geometryGml)
#

ST_GeomFromText

Returns a Point as a blob 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#>
Blob 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 Blob 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#>
#
#Usage: geof:ST_GeomFromText(wkt_string,wkid)
# wkt_string - Multi-Polygon String in WKT string format
#
#Return: Multi-Polygon String shape in binary format(BLOB)
#
#*****************************************************************************
#Read Multi Polygon Strings from WKT shape whose object id=0
#Return Blob object into Text format
#
select (geof:ST_AsText(geof:ST_GeomFromText(?multi_pt_wkt,0)) as ?multi_polygon)
from <multipolygon>
where {
  ?multi_pt a <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
  <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
  <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#Ans
#MULTIPOLYGON (((-76.38363699929707 39.228667999083235, -76.37720099968107 39.22034299875703, -76.36364300018569 39.227718999250115, -76.37023093545895 39.2356160242013, -76.38363699929707 39.228667999083235)), ((-76.37023093545895 39.2356160242013, -76.37014800029698 39.235658999049015, -76.37030099955953 39.23569999921678, -76.37023093545895 39.2356160242013)))

ST_GeomFromWKB

Returns a Point as a blob 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#>
Blob 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 Blob 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_GeomFromCollectionText Returns geometry objects from a WKT collection file.
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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

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(Blob geom)

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

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
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ?no_pt_ln ?xmin ?xmax ?ymin ?ymax
from <multipoint>
where {
  ?ln_str_ins a <http://anzograph.com/wind_speed_at_block_group_level/multipoint>;
  <http://anzograph.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
  <http://anzograph.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
  BIND(geof:ST_GeomFromText(?multi_pt_wkt,0) 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
#ans
#1520,-96.902438,-86.822438,22.548199,27.789799
 

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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

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
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ?no_pt_ln ?xmin ?xmax ?ymin ?ymax
from <multipoint>
where {
  ?ln_str_ins a <http://anzograph.com/wind_speed_at_block_group_level/multipoint>;
  <http://anzograph.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
  <http://anzograph.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
  BIND(geof:ST_GeomFromText(?multi_pt_wkt,0) 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
#ans
#1520,-96.902438,-86.822438,22.548199,27.789799

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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

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
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select ?no_pt_ln ?xmin ?xmax ?ymin ?ymax
from <multipoint>
where {
  ?ln_str_ins a <http://anzograph.com/wind_speed_at_block_group_level/multipoint>;
  <http://anzograph.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
  <http://anzograph.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
  BIND(geof:ST_GeomFromText(?multi_pt_wkt,0) 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
#ans
#1520,-96.902438,-86.822438,22.548199,27.789799

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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
select (geof:ST_MinZ(geof:ST_GeomFromText(?x)) as ?minZ)
where {
values (?x ) {('MULTIPOINT Z(10 40 1, 40 30 2)') ('LINESTRING Z(30 10 10, 10 10 30, 40 40 10)') ('POLYGON Z((35 -10 34, 15 40 20, 10 -20 12, 35 -10 34),(20 -30 12, 35 -35 53, -30 20 60, 20 30 12))')}
}

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(Blob geom)  

The function return an xsd:double value.

Argument Data Type Description
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
select (geof:ST_MaxZ(geof:ST_GeomFromText(?x)) as ?maxZ)
where {
  values (?x ) {('MULTIPOINT Z(10 40 1, 40 30 2)') ('LINESTRING Z(30 10 10, 10 10 30, 40 40 10)') ('POLYGON Z((35 -10 34, 15 40 20, 10 -20 12, 35 -10 34),(20 -30 12, 35 -35 53, -30 20 60, 20 30 12))')}
}

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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
select (geof:ST_MinM(geof:ST_GeomFromText(?x)) as ?minM)
where {
values (?x ) {('POLYGON M((35 10 34, 15 -40 20, -10 20 12, 35 10 34),
  (20 -30 12, 35 35 -53, 30 20 60, -20 30 12))') 
  ('POLYGON ZM((35 10 34 10, 45 45 10 20, 15 40 20 30, 35 10 34 10),
  (20 30 12 40, 35 35 53 10, 30 20 60 30, 20 30 12 40))')}
}

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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
select (geof:ST_MaxM(geof:ST_GeomFromText(?x)) as ?maxM)
where {
  values (?x ) {('POLYGON M((35 10 34, 15 -40 20, -10 20 12, 35 10 34),
    (20 -30 12, 35 35 -53, 30 20 60, -20 30 12))') 
    ('POLYGON ZM((35 10 34 10, 45 45 10 20, 15 40 20 30, 35 10 34 10),
    (20 30 12 40, 35 35 53 10, 30 20 60 30, 20 30 12 40))')}
}

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(Blob geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Read Point from WKT shape whose object id=100
#Return Blob object into geo json format
#
select (geof:ST_AsGeoJSON(?point_2d) as ?point)
from <point>
where{
  ?point a <http://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  <http://anzograph.com/geologic_units_24k/id> "100"^^xsd:long.
  BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
}
#Ans
#{"type":"Point","coordinates":[-122.05045797533386,47.550270129490144],"crs":null}

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(Blob geom)

The function returns an xsd:string value.

Argument Data Type Description
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Read Point from WKT shape whose object id=0
#Return Blob object into json format
#
select (geof:ST_AsJSON(geof:ST_Point(?point_x, ?point_y)) as ?result)
from <point>
where{
  ?point a <http://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  <http://anzograph.com/geologic_units_24k/id> "0"^^xsd:long.
  BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
  BIND(geof:ST_X(?point_2d) as ?point_x)
  BIND(geof:ST_Y(?point_2d) as ?point_y)
}
#Ans
#{"x":-122.11508987446247,"y":47.54868099704251}

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#>
Blob geof:ST_AsBinary(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

Example Query:

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

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(Blob geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Blob  

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_GeomFromText(?x,0)) as ?polygon)
where {
  values (?x) {('POLYGON ((2 0, 2 3, 3 0))') ('POLYGON ((2 0, 2 1, 3 1))')}
}

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(Blob geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Blob  

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#>
geo:wktLiteral geo:ST_AsWktLiteral(Blob geom)  

The function returns a geo:wktLiteral value.

Argument Data Type Description
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema
[ Example not available ]

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#>
geo:wktLiteral geo:ST_AsGmlLiteral(Blob geom)

The function returns a geo:wktLiteral value.

Argument Data Type Description
geom Blob  

Example Query:

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

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(Blob geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Blob  

Example Query:

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

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(Blob geom)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom Blob  

Example Query:

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

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(Blob geom)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom Blob  

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Check whether shape is empty or not
#Return Boolean whether shape is empty or not
select (geof:ST_IsEmpty(geof:ST_GeomFromText(?x,0)) 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(Blob geom)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom Blob  

Example Query:

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

The function returns an xsd:boolean value.

Argument Data Type Description
geom Blob  

Example Query:

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

ST_Crosses

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(Blob geom1, Blob geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2) 

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2)

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2)  

The function return an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0)) 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(Blob geom1, Blob geom2)  

The function returns an xsd:boolean value.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0),?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(Blob geom1, Blob geom2 
  [units: xsd:anyURI [,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 Blob  
geom2 Blob  
xsd:anyURI units:  
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,0),geof:ST_GeomFromText(?y,0)) 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#>
Blob geof:ST_Boundary(Blob geom)  

The function returns: a Blob object.

Argument Data Type Description
geom Blob  

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,0))) 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#>
Blob geof:ST_Intersection(Blob geom1, Blob geom2)  

The function returns a Blob object.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0))) 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#>
Blob geof:ST_Difference(Blob geom1, Blob geom2)  

The function returns a Blob object.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0))) 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#>
Blob geof:ST_SymDifference(Blob geom1, Blob geom2)  

The function returns a Blob object.

Argument Data Type Description
geom1 Blob  
geom2 Blob  

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,0),geof:ST_GeomFromText(?y,0))) 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(Blob geom)  

The function returns an xsd:int value.

Argument Data Type Description
geom Blob  

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_GeomFromText(?x,0)) 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#>
Blob geof:ST_SetSRID(Blob geom, xsd:int wkid)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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,0) , 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(Blob geom)  

The function returns an xsd:int value.

Argument Data Type Description
geom Blob  

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,0)) as ?Dimension)
where {
  values (?x) {('POLYGON ((2 0, 2 3, 3 0))') ('POLYGON ((2 0, 2 1, 3 1))')}
}

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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

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,0)) 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(Blob geom)  

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

Argument Data Type Description
geom Blob  

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,0)) as ?Area)
where {
  values (?x) {('POLYGON ((0 0, 0 8, 8 0, 0 0), (1 1, 1 5, 5 1, 1 1))') ('POLYGON ((1 1, 1 4, 4 1, 4 4))')}
}

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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

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,0)) 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#>
Blob geof:ST_Envelope(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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,0))) 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(Blob geom)  

The function returns an xsd:string value.

Argument Data Type Description
geom Blob  

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,0)) as ?geometry_type)
where {
  values (?x) {('POINT(2 4.4)') ('POINT(-12 4.4)')}
}

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#>
Blob geof:ST_Union(Blob geom1 [,Blob geom_N]*)  

The function returns a Blob object.

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

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://anzograph.com/geologic_units_24k/point>;  
  <http://anzograph.com/geologic_units_24k/id> "0"^^<http://www.w3.org/2001/XMLSchema#long>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape.
  ?point1 a <http://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/id> "1"^^<http://www.w3.org/2001/XMLSchema#long>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape1;
  BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
  BIND(geof:ST_GeomFromText(?shape1,0) as ?point_2d1)
}
#Ans
#2

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(Blob geom)  

The function returns an xsd:int value.

Argument Data Type Description
geom Blob  

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://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/id> "0"^^<http://www.w3.org/2001/XMLSchema#long>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape.
  ?point1 a <http://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/id> "1"^^<http://www.w3.org/2001/XMLSchema#long>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape1;
  BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
  BIND(geof:ST_GeomFromText(?shape1,0) as ?point_2d1)
}
#Ans
#2

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(Blob geom)  

The function returns an xsd:int value.

Argument Data Type Description
geom Blob  

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,0)) as ?multi_polygon)
from <multipolygon>
where {
  ?multi_pt a <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
  <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
  <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#Ans
#2

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#>
Blob geof:ST_GeometryN(Blob geom, xsd:int index)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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,0), 0)) as ?multi_polygon)
from <multipolygon>
where {
?multi_pt a <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#Ans
#POLYGON ((-76.38363699929707 39.228667999083235, -76.37720099968107 39.22034299875703, -76.36364300018569 39.227718999250115, -76.37023093545895 39.2356160242013, -76.38363699929707 39.228667999083235))

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#>
Blob geof:ST_Centroid(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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,0))) as ?multi_polygon)
from <multipolygon>
where {
?multi_pt a <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#Ans
#POINT (-76.3736976102077 39.22805141980267)

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#>
Buffer geof:ST_Buffer(Blob geom, xsd:double distance)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  
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,0), 1)) as ?multi_polygon)
from <multipolygon>
where {
?multi_pt a <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#Ans
#POLYGON ((-76.37720099968107 ... 38.22034299875703))

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#>
Blob geof:ST_ConvexHull(Blob geom1 [,Blob geom_N]*)  

The function returns a Blob object.

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

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)',0), geof:ST_GeomFromText('point(0 1)',0), geof:ST_GeomFromText('point(1 1)',0))) as ?convex_hull)
from <multipolygon>
where {
?multi_pt a <http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://anzograph.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#Ans
#MULTIPOLYGON (((0 0, 1 1, 0 1, 0 0)))

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(Blob geom)  

The function returns an xsd:double value.

Argument Data Type Description
geom Blob  

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 ,?y)) as ?geodesic_length)
where {
  values (?x ?y) {('LineString(0 0, 0.03 0.04)' 4326) ('MultiLineString((0 80, 0.03 80.04))' 4326)}
}

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#>
Blob geof:ST_GeomFromJSON(xsd:string json)  

The function returns a Blob 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,0)))) 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#>
Blob geof:ST_GeomFromGeoJSON(xsd:string geojson)  

The function returns a Blob 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,0)))) 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:string 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:string  

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_GeomFromCollectionText

Returns equivalent spherical coordinates for given Cartesian coordinates. The general signature for calling the ST_GeomFromCollectionText 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_GeomFromCollectionText(xsd:string wkt [, xsd:int wkid])  

Here 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 an xsd:string object.

Argument Data Type Description
wkt 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_GeomFromCollectionText('GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))',0) 
as ?Geometry_collection)
#

ST_GeomFromWktLiteral

Returns a Blob 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#>
Blob geof:ST_GeomFromWktLiteral(geo:wktLiteral)  

The function returns a Blob 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 Blob 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#>
Blob geof:ST_GeomFromGmlLiteral(geo:wktLiteral)  

The function returns an Blob 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, IRI sourceSys, IRI 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 IRI  
destSys IRI  

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)',0)))   
  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#>
Blob geof:ST_Translate(Blob geom, xsd:double x_delta, 
                   xsd:double y_delta [, xsd:double z_delta])  

The first input argument is a geometric shape in Blob 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 Blob object.

Argument Data Type Description
geom Blob  
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('MULTIPOINT(10 40, 40 30)',0),1,2)) 
  as ?transformed_multiPoint)
#

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#>
Blob geof:ST_Scale(Blob geom, xsd:double x_sf, xsd:double y_sf 
               [, xsd:double z_sf])  

The first input argument is a geometric shape in Blob 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 Blob object.

Argument Data Type Description
geom Blob  
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)',0),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#>
Blob geof:ST_Shear(Blob geom, double x_shear, double y_shear 
               [, double z_shear])  

The first input argument is a geometric shape in Blob 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 Blob object.

Argument Data Type Description
geom Blob  
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)',0),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/>
Blob geof:ST_Rotate(Blob geom, xsd:double angle_rads, xsd:string axis)  

The first input argument is a geometric shape in Blob 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 Blob object.

Argument Data Type Description
geom Blob  
angle_rads xsd:double  
axis 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_Rotate(geof:ST_GeomFromText('POINT (1 1)'),20,geof:X)) 
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#>
Blob geof:ST_Aggr_Union(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
}
#Ans
#30964

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#>
Blob geof:ST_Aggr_LineString(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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_GeomFromText(?x,0) as ?point)
  where{
    values (?x) {('LINESTRING (8 7, 7 8)')('LINESTRING (1 7, 7 8)')}
  }
}
#

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#>
Blob geof:ST_Aggr_MultiLineString(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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,0) as ?point)
  where{
    values (?x) {('MULTILINESTRING ((8 7, -7 8), (-1 7, 7 8))')('MULTILINESTRING ((-8 7, 7 8), (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#>
Blob geof:ST_Aggr_MultiPoint(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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#>
Blob geof:ST_Aggr_Polygon(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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#>
Blob geof:ST_Aggr_MultiPolygon(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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,0) 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#>
Blob geof:ST_Aggr_ConvexHull(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
}
#Ans
#9

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#>
Blob geof:ST_Aggr_Intersection(Blob geom)  

The function returns a Blob object.

Argument Data Type Description
geom Blob  

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://anzograph.com/geologic_units_24k/point>;
  <http://anzograph.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,0) as ?point_2d)
}
#Ans
#0

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#>
Blob geof:ST_ReadSHP(xsd:string filePath)  

The function returns a Blob 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 MultiLine Strings from shape File
#Return Blob multiline objects and corresponding ID
#
CREATE OR REPLACE QUERY <multiline_table> AS
SELECT *
WHERE {
SERVICE <http://www.opengis.net/def/function/geosparql/ST_ReadSHP>('{CURRENT_DIR}/../data/Power_Line_Aboveground.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#>
Blob geof:ST_ReadKML(xsd:string filePath)  

The function returns a Blob 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#>
Blob geof:ST_ReadGeoJSON(xsd:string filePath)  

The function returns a Blob 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#>
Blob geof:ST_ReadText(xsd:string filePath)  

The function returns a Blob 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#>
Blob geof:ST_ReadGML(xsd:string filePath)  

The function returns a Blob 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#>
Blob geof:ST_ReadWKB(xsd:string filePath)  

The function returns a Blob 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') {} 
}