Additional Geospatial Functions (PREVIEW)

AnzoGraph offers an additional PREVIEW package of pre-built geospatial functions that you can use in the same way as other native, built-in analytic functions.

AnzoGraph has developed this Geospatial and GeoSPARQL functionality 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 functions is 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.

The geospatial functions (UDFs) available are organized into the following categories:

  • 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 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, .kml, and .json.

The topics in this section provide details about each of the 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_PointConstructs a Point geometry from a given set of x, y, z, and m coordinates.
ST_XReturns the X coordinate of a given Point geometry.
ST_SetXSets the X coordinate of a given Point geometry.
ST_YReturns the Y coordinate of a given Point geometry.
ST_SetYSets the Y coordinate of a given Point geometry.
ST_ZReturns the Z coordinate of a given Point geometry.
ST_SetZSets the Z coordinate of a given Point geometry.
ST_MReturns the M coordinate of a given Point geometry.
ST_SetMSets the M coordinate of a given Point geometry.
ST_BinReturns the bin ID of a given Point geometry.
ST_BinEnvelopeReturns the bin envelope for a given Point geometry or bin ID.
ST_MultiPointConstructs 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_LineStringConstructs a LineString from a number of Points in an array.
ST_StartPointReturns the start Point of a given line.
ST_EndPointReturns the end Point of a given line.
ST_IsClosedDetermines 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_IsRingDetermines whether a given geometry is closed. That is, it returns true if a specific geometry is closed; otherwise, it returns false.
ST_MultiLineStringReturns the MultiLine geometry constructed from a list of individual Line geometries.
Polygon and Other Geometric Functions:
ST_PolygonReturns a Polygon geometry constructed from multiple point geometries.
ST_ExteriorRingReturns the exterior ring of a given polygon geometry.
ST_NumInteriorRingReturns the number of interior rings that exist in a given polygon geometry.
ST_InteriorRingNReturns the interior ring at the Nth index position in a given polygon geometry.
ST_MultiPolygonReturns 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_CircleArcReturns a Circle Arc Polygon from a given radius and point geometry.
ST_ArcReturns an Arc line from a given start angle and size angle.
ST_EllipseReturns an Ellipse Polygon from a given radius and point geometry.
ST_EllipticalArcReturns an Elliptical Arc Polygon from a given radius and point geometry.
ST_RectangleReturns a Rectangle Polygon from a given height, width, and point geometry.
ST_SquircleReturns a Squircle Polygon from a given radius and point geometry.
Construct Geometry from GML, WKB, or WKT(and optionally WKID):
ST_GeomFromGMLReturns 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:

FunctionDescription
ST_MinXReturns the minimum value of the X coordinate for a given geometry.
ST_MaxXReturns the maximum value of the X coordinate for a given geometry.
ST_MinYReturns the minimum value of the Y coordinate for a given geometry.
ST_MaxYReturns the maximum value of the Y coordinate for a given geometry.
ST_MinZReturns the minimum value of Z coordinate for a given geometry.
ST_MaxZReturns the maximum value of Z coordinate for a given geometry.
ST_MinMReturns the minimum measure value for a given geometry
ST_MaxMReturns the maximum measure value for a given geometry.
Serialization: 
ST_AsGeoJSONReturns a GeoJSON representation of a geometric shape.
ST_AsJSONReturns a JSON representation of a geometric shape.
ST_AsBinaryReturns a binary object from a given geometry.
ST_AsTextReturns a well known text (WKT) representation of a geometric shape.
ST_AsGMLReturns GML representation of a geometric shape.
ST_AsWKT_URLReturns URL from WKT representation of a given geometry.
ST_AsGML_URLReturns URL from GML representation of a given geometry.<http://www.w3.org/2003/01/geo/wgs84_pos#>
ST_AsWKB_HEXReturns hex string from WKB representation of a given geometry.
Logical, Comparison, and Relational Operations:
ST_Is3DReturns true if a given geometry object is three-dimensional.
ST_IsEmptyReturns true if a given geometry object is empty.
ST_IsMeasuredReturns true if a given geometry object is measured.
ST_IsSimpleReturns true if a given geometry object is simple.
ST_CrossesReturns true if geometry1 crosses geometry2.
ST_ContainsReturns true if geometry1 contains geometry2.
ST_DisjointReturns true if geometry1 doesn’t have any Points in common with geometry2.
ST_EqualsReturns true if geometry1 equals geometry2.
ST_IntersectsReturns true if geometry1 intersects geometry2.
ST_OverlapsReturns true if geometry1 overlaps geometry2.
ST_TouchesReturns true if geometry1 touches geometry2.
ST_WithinReturns true if geometry1 is within geometry2.
ST_EnvIntersectsReturns true if the envelopes of geometry1 and geometry2 intersect.
ST_RelateReturns true if geometry1 has the specified DE-9IM relationship with geometry2.
Conversion, Calculation, and Translation:
ST_DistanceReturns the distance between two geometry objects.
ST_BoundaryReturns the boundary of a given geometry.
ST_IntersectionReturns the intersection of two geometry objects.
ST_DifferenceReturns the difference between two geometry objects.
ST_SymDifferenceReturns the symmetric difference between two geometry objects.
ST_SRIDReturns 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_DimensionReturns the spatial dimension of a given geometry.
ST_LengthReturns the length of a line.
ST_AreaReturns the area of a Polygon or multiPolygon.
ST_CoordDimReturns the count of coordinate components.
ST_EnvelopeReturns the envelope of a given geometry.
ST_GeometryTypeReturns the geometry type of a given geometry.
ST_UnionReturns the union of one or more geometries.
ST_NumPointsReturns the number of Points in a given geometry.
ST_NumGeometriesReturns the number of geometries in a multi-geometry shape.
ST_GeometryNReturns the Nth geometry in a multi-geometry shape.
ST_CentroidReturns the centroid of a given geometry.
ST_BufferReturns the geometry buffered by distance.
ST_ConvexHullReturns the convex hull of one or more geometries.
ST_GeodesicLengthWGS84Returns the distance (in meters) along a line of a WGS84 spheroid for geographic coordinates.
ST_GeomFromJSONReturns the geometry from a JSON representation of any geometric shape.
ST_GeomFromGeoJSONReturns the geometry from a GeoJSON representation of any geometric shape.
ST_LatLonFromDMSToDDReturns latitude and longitude in decimal degrees.
ST_GeomFromCollectionTextReturns geometry objects from a WKT collection file.
ST_ConvertCoordinates

Return coordinates converted from one coordinate system to another.

ST_IsValidWKTValidates 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_ScaleScales a geometry to a new size using the corresponding factor arguments.
ST_ShearShears a geometry around axis using specified shearing arguments.
ST_RotateRotate geometry around origin using corresponding rotation arguments.

The following are Aggregator (UDA) Functions:

Aggregator (UDA) FunctionsDescription
ST_Aggr_UnionReturns a union of geometries using Aggregator transformation.
ST_Aggr_LineStringReturns a Line geometry constructed from a number of Point geometries using Aggregator transformation.
ST_Aggr_MultiLineStringReturns a MultiLine geometry constructed from a number of line geometries using Aggregator transformation.
ST_Aggr_MultiPointReturns a MultiPoint geometry constructed from a number of Point geometries using Aggregator transformation.
ST_Aggr_PolygonReturns a Polygon geometry constructed from a number of Point geometries using Aggregate Point geometries and Aggregator transformation.
ST_Aggr_MultiPolygonReturns a MultiPolygon geometry constructed from multiple polygon geometries using Aggregator transformation.
ST_Aggr_ConvexHullReturns a convex hull for given geometries obtained using Aggregator transformation.
ST_Aggr_IntersectionReturns intersection of given geometries having same srID obtained using Aggregator transformation.

The following are Services (UDS) Functions:

Service (UDS) functionsDescription
ST_ReadSHPReturns geometry objects extracted from a Shapefile shape (SHP) format file.
ST_ReadKMLReturns geometry objects extracted from a Keyhole Markup Language (KML) file.
ST_ReadGeoJSONReturns geometry objects extracted from a JSON format file.
ST_ReadTextReturns geometry objects extracted from a Well-Known Text (WKT) file.
ST_ReadGMLReturns geometry objects extracted from a Geography Markup Language (GML) format file.
ST_ReadWKBReturns geometry objects extracted from an OpenGIS Well-known Binary (WKB) file.

The following sections provided additional detail of each available geometric function (listed in alphabetical order) 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.

NoteSome 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.

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.

FunctionDescription
ST_PointConstructs a Point geometry from a given set of x, y, z, and m coordinates.
ST_XReturns the X coordinate of a given Point geometry.
ST_SetXSets the X coordinate of a given Point geometry.
ST_YReturns the Y coordinate of a given Point geometry.
ST_SetYSets the Y coordinate of a given Point geometry.
ST_ZReturns the Z coordinate of a given Point geometry.
ST_SetZSets the Z coordinate of a given Point geometry.
ST_MReturns the M coordinate of a given Point geometry.
ST_SetMSets the M coordinate of a given Point geometry.
ST_BinReturns the bin ID of a given Point geometry.
ST_BinEnvelopeReturns the bin envelope for a given Point geometry or bin ID.
ST_MultiPointConstructs 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.

ArgumentData TypeDescription
xxsd:double 
yxsd: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://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/shape> ?shape;
  <http://csi.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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/geologic_units_24k/point>;
  <http://csi.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.

ArgumentData TypeDescription
geomBlob 
xxsd: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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/geologic_units_24k/point>;  
  <http://csi.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.

ArgumentData TypeDescription
geomBlob 
yxsd: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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/geologic_units_24k/point>;
  <http://csi.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.

ArgumentData TypeDescription
geomBlob 
zxsd: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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/geologic_units_24k/point>;
  <http://csi.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.

ArgumentData TypeDescription
geomBlob 
mxsd: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.

ArgumentData TypeDescription
binSizexsd:double 
geomBlob 

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://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/shape> ?shape;
  <http://csi.com/geologic_units_24k/id> "0"^^xsd:long.
  BIND(geof:ST_GeomFromText(?shape,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.

ArgumentData TypeDescription
binSizexsd:double  
geomBlob 

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
select (geof:ST_AsText(geof:ST_BinEnvelope(10.0, ?point_2d)) as ?union)
from <point>
where{
  ?point a <http://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/shape> ?shape;
  <http://csi.com/geologic_units_24k/id> "0"^^xsd:long.  
BIND(geof:ST_GeomFromText(?shape,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.

ArgumentData TypeDescription
x xsd:double 
yxsd: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.

ArgumentData TypeDescription
geomBlob 
indexxsd: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.

FunctionDescription
ST_LineStringConstructs a LineString from a number of Points in an array.
ST_StartPointReturns the start Point of a given line.
ST_EndPointReturns the end Point of a given line.
ST_IsClosedDetermines 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_IsRingDetermines whether a given geometry is closed. That is, it returns true if a specific geometry is closed; otherwise, it returns false.
ST_MultiLineStringReturns 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.

ArgumentData TypeDescription
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.

ArgumentData TypeDescription
lineBlob 

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://csi.com/road_centerline/linestring>;
  <http://csi.com/road_centerline/shape> ?line_str_wkt;
  <http://csi.com/road_centerline/no_of_points> ?no_pt_ln.
}
order by desc(?no_pt_ln) desc(?line_str_wkt)
limit 1
#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.

ArgumentData TypeDescription
lineBlob 

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://csi.com/road_centerline/linestring>;
  <http://csi.com/road_centerline/shape> ?line_str_wkt;
  <http://csi.com/road_centerline/no_of_points> ?no_pt_ln.
}
order by desc(?no_pt_ln) desc(?line_str_wkt)
limit 1
#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.

ArgumentData TypeDescription
lineBlob 

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.

ArgumentData TypeDescription
lineBlob 

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.

ArgumentData TypeDescription
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.

FunctionDescription
Polygon and Other Geometric Functions:
ST_PolygonReturns a Polygon geometry constructed from multiple point geometries.
ST_ExteriorRingReturns the exterior ring of a given polygon geometry.
ST_NumInteriorRingReturns the number of interior rings that exist in a given polygon geometry.
ST_InteriorRingNReturns the interior ring at the Nth index position in a given polygon geometry.
ST_MultiPolygonReturns 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_CircleArcReturns a Circle Arc Polygon from a given radius and point geometry.
ST_ArcReturns an Arc line from a given start angle and size angle.
ST_EllipseReturns an Ellipse Polygon from a given radius and point geometry.
ST_EllipticalArcReturns an Elliptical Arc Polygon from a given radius and point geometry.
ST_RectangleReturns a Rectangle Polygon from a given height, width, and point geometry.
ST_SquircleReturns a Squircle Polygon from a given radius and point geometry.
Construct Geometry from GML, WKB, or WKT(and optionally WKID):
ST_GeomFromGMLReturns 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.

ArgumentData TypeDescription
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.

ArgumentData TypeDescription
polygonBlob 

Example Query:

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

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.

ArgumentData TypeDescription
polygonBlob 

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://csi.com/national_weather_service_wind_gust_forecast/polygon>;
  <http://csi.com/national_weather_service_wind_gust_forecast/shape> ?multi_pt_wkt;
  <http://csi.com/national_weather_service_wind_gust_forecast/id> "0"^^xsd:int.
}
#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.

ArgumentData TypeDescription
polygonBlob 
nxsd:int 

Example Query:

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

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.

ArgumentData TypeDescription
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.

ArgumentData TypeDescription
geomBlob 
radiusxsd: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.

ArgumentData TypeDescription
geomBlob 
radiusxsd:double  
numOfPointsxsd: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.

ArgumentData TypeDescription
x

xsd:double

 
yxsd:double 
radiusxsd:double  
startRadxsd:double 
sizeRadxsd:double  
numOfPointsxsd: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.

ArgumentData TypeDescription
center_ptBlob 
xRadiusxsd: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.

ArgumentData TypeDescription
geomBlob 
radiusxsd:double 
numOfPointsxsd:int 

Example Query:

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

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.

ArgumentData TypeDescription
geomBlob 
widthxsd:double 
heightxsd: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.

ArgumentData TypeDescription
geomBlob 
radius xsd:double  
numOfPointsxsd: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.

ArgumentData TypeDescription
gmlxsd: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.

ArgumentData TypeDescription
wktxsd: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://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
  <http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
  <http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#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.

ArgumentData TypeDescription
wkb_hexstrxsd: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.

FunctionDescription
ST_MinXReturns the minimum value of the X coordinate for a given geometry.
ST_MaxXReturns the maximum value of the X coordinate for a given geometry.
ST_MinYReturns the minimum value of the Y coordinate for a given geometry.
ST_MaxYReturns the maximum value of the Y coordinate for a given geometry.
ST_MinZReturns the minimum value of Z coordinate for a given geometry.
ST_MaxZReturns the maximum value of Z coordinate for a given geometry.
ST_MinMReturns the minimum measure value for a given geometry
ST_MaxMReturns the maximum measure value for a given geometry.
Serialization:
ST_AsGeoJSONReturns a GeoJSON representation of a geometric shape.
ST_AsJSONReturns a JSON representation of a geometric shape.
ST_AsBinaryReturns a binary object from a given geometry.
ST_AsTextReturns a well known text (WKT) representation of a geometric shape.
ST_AsGMLReturns geometry from GML representation of geometric shape.
ST_AsWKT_URLReturns URL from WKT representation of a given geometry.
ST_AsGML_URLReturns URL from GML representation of a given geometry.
ST_AsWKB_HEXReturns hex string from WKB representation of a given geometry.
Logical, Comparison, and Relational Operations:
ST_Is3DReturns true if a given geometry object is three-dimensional.
ST_IsEmptyReturns true if a given geometry object is empty.
ST_IsMeasuredReturns true if a given geometry object is measured.
ST_IsSimpleReturns true if a given geometry object is simple.
ST_CrossesReturns true if geometry1 crosses geometry2.
ST_ContainsReturns true if geometry1 contains geometry2.
ST_DisjointReturns true if geometry1 doesn’t have any Points in common with geometry2.
ST_EqualsReturns true if geometry1 equals geometry2.
ST_IntersectsReturns true if geometry1 intersects geometry2.
ST_OverlapsReturns true if geometry1 overlaps geometry2.
ST_TouchesReturns true if geometry1 touches geometry2.
ST_WithinReturns true if geometry1 is within geometry2.
ST_EnvIntersectsReturns true if the envelopes of geometry1 and geometry2 intersect.
ST_RelateReturns true if geometry1 has the specified DE-9IM relationship with geometry2.
Conversion, Calculation, and Translation:
ST_DistanceReturns the distance between two geometry objects.
ST_BoundaryReturns the boundary of a given geometry.
ST_IntersectionReturns the intersection of two geometry objects.
ST_DifferenceReturns the difference between two geometry objects.
ST_SymDifferenceReturns the symmetric difference between two geometry objects.
ST_SRIDReturns 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_DimensionReturns the spatial dimension of a given geometry.
ST_LengthReturns the length of a line.
ST_AreaReturns the area of a Polygon or multiPolygon.
ST_CoordDimReturns the count of coordinate components.
ST_EnvelopeReturns the envelope of a given geometry.
ST_GeometryTypeReturns the geometry type of a given geometry.
ST_UnionReturns the union of one or more geometries.
ST_NumPointsReturns the number of Points in a given geometry.
ST_NumGeometriesReturns the number of geometries in a multi-geometry shape.
ST_GeometryNReturns the Nth geometry in a multi-geometry shape.
ST_CentroidReturns the centroid of a given geometry.
ST_BufferReturns the geometry buffered by distance.
ST_ConvexHullReturns the convex hull of one or more geometries.
ST_GeodesicLengthWGS84Returns the distance (in meters) along a line of a WGS84 spheroid for geographic coordinates.
ST_GeomFromJSONReturns the geometry from a JSON representation of any geometric shape.
ST_GeomFromGeoJSONReturns the geometry from a GeoJSON representation of any geometric shape.
ST_LatLonFromDMSToDDReturns latitude and longitude in decimal degrees.
ST_GeomFromCollectionTextReturns geometry objects from a WKT collection file.
ST_ConvertCoordinates

Return coordinates converted from one coordinate system to another.

ST_IsValidWKTValidates 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_ScaleScales a geometry to a new size using the corresponding factor arguments.
ST_ShearShears a geometry around axis using specified shearing arguments.
ST_RotateRotate 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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/wind_speed_at_block_group_level/multipoint>;
  <http://csi.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
  <http://csi.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
  BIND(geof:ST_GeomFromText(?multi_pt_wkt,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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/wind_speed_at_block_group_level/multipoint>;
  <http://csi.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
  <http://csi.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
  BIND(geof:ST_GeomFromText(?multi_pt_wkt,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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/wind_speed_at_block_group_level/multipoint>;
  <http://csi.com/wind_speed_at_block_group_level/shape> ?multi_pt_wkt;
  <http://csi.com/wind_speed_at_block_group_level/no_of_points> ?no_pt_ln;
  BIND(geof:ST_GeomFromText(?multi_pt_wkt,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.

ArgumentData TypeDescription
geomBlob 

Example Query:

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

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.

ArgumentData TypeDescription
geomBlob 

Example Query:

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

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.

ArgumentData TypeDescription
geomBlob 

Example Query:

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

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.

ArgumentData TypeDescription
geomBlob 

Example Query:

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

 

 

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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/shape> ?shape;
  <http://csi.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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/shape> ?shape;
  <http://csi.com/geologic_units_24k/id> "0"^^xsd:long.
  BIND(geof:ST_GeomFromText(?shape,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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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_AsWKT_URL

Returns URL from well known text (WKT) representation of a geometric shape. The general signature for calling the ST_AsWKT_URL 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_AsWKT_URL(Blob geom)  

The function returns a geo:wktLiteral value.

ArgumentData TypeDescription
geomBlob 

Example Query:

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

ST_AsGML_URL

Returns URL from GML representation of a geometric shape. The general signature for calling the ST_AsGML_URL 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_AsGML_URL(Blob geom)

The function returns a geo:wktLiteral value.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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)  

The function returns an xsd:double value.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geom1Blob 
geom2Blob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 
wkidxsd: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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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 an xsd:double value.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
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://csi.com/geologic_units_24k/point>;  
  <http://csi.com/geologic_units_24k/id> "0"^^<http://www.w3.org/2001/XMLSchema#long>;
  <http://csi.com/geologic_units_24k/shape> ?shape.
  ?point1 a <http://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/id> "1"^^<http://www.w3.org/2001/XMLSchema#long>;
  <http://csi.com/geologic_units_24k/shape> ?shape1;
  BIND(geof:ST_GeomFromText(?shape,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.

ArgumentData TypeDescription
geomBlob 

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
select (geof:ST_NumPoints(geof:ST_Union(?point_2d, ?point_2d1)) as ?union)
from <point>
where{
  ?point a <http://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/id> "0"^^<http://www.w3.org/2001/XMLSchema#long>;
  <http://csi.com/geologic_units_24k/shape> ?shape.
  ?point1 a <http://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/id> "1"^^<http://www.w3.org/2001/XMLSchema#long>;
  <http://csi.com/geologic_units_24k/shape> ?shape1;
  BIND(geof:ST_GeomFromText(?shape,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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
  <http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
  <http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#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.

ArgumentData TypeDescription
geomBlob 
indexxsd: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://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#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.

ArgumentData TypeDescription
geomBlob 

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://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#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.

ArgumentData TypeDescription
geomBlob 
distancexsd: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://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#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.

ArgumentData TypeDescription
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://csi.com/maryland_Shellfish__historic_oyster_plantings/multipolygon>;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/shape> ?multi_pt_wkt;
<http://csi.com/maryland_Shellfish__historic_oyster_plantings/id> "0"^^xsd:int.
}
#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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
jsonxsd: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.

ArgumentData TypeDescription
geojsonxsd: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.

ArgumentData TypeDescription
degreesxsd:double 
minutesxsd:double 
seconds xsd:double  
directionxsd: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_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.

ArgumentData TypeDescription
wktxsd: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_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.

ArgumentData TypeDescription
xxsd:double 
yxsd:double 
zxsd:double 
sourceSysIRI 
destSysIRI 

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.

ArgumentData TypeDescription
wktxsd: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.

ArgumentData TypeDescription
geojsonxsd: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.

ArgumentData TypeDescription
geomBlob 
x_deltaxsd:double  
y_deltaxsd: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.

ArgumentData TypeDescription
geomBlob 
x_sfxsd: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.

ArgumentData TypeDescription
geomBlob 
x_shearxsd:double  
y_shearxsd: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.

ArgumentData TypeDescription
geomBlob 
angle_radsxsd:double 
axisxsd: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.

FunctionDescription
ST_Aggr_UnionReturns union of geometries using Aggregator transformation.
ST_Aggr_LineStringReturns Line geometry constructed from a number of Point geometries using Aggregator transformation.
ST_Aggr_MultiLineStringReturns MultiLine geometry constructed from a number of line geometries using Aggregator transformation.
ST_Aggr_MultiPointReturns MultiPoint geometry constructed from a number of Point geometries using Aggregator transformation.
ST_Aggr_PolygonReturns Polygon geometry constructed from a number of Point geometries using Aggregate Point geometries and Aggregator transformation.
ST_Aggr_MultiPolygonReturns MultiPolygon geometry constructed from multiple polygon geometries using Aggregator transformation.
ST_Aggr_ConvexHullReturns convex hull for given geometries obtained using Aggregator transformation.
ST_Aggr_IntersectionReturns 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.

ArgumentData TypeDescription
geomBlob 

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
select (geof:ST_NumPoints(geof:ST_Aggr_Union(?point_2d)) as ?union)
from <point>
where{
  ?point a <http://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

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.

ArgumentData TypeDescription
geomBlob 

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Return Number of points of convex hull
#
select (geof:ST_NumPoints(geof:ST_Aggr_ConvexHull(?point_2d)) as ?convex_hull)
from <point>
where{
  ?point a <http://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,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.

ArgumentData TypeDescription
geomBlob 

Example Query:

PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
#
#Read Point from WKT shape
#Return Number of points intersections
#
select (geof:ST_NumPoints(geof:ST_Aggr_Intersection(?point_2d)) as ?union)
from <point>
where{
  ?point a <http://csi.com/geologic_units_24k/point>;
  <http://csi.com/geologic_units_24k/shape> ?shape;
  BIND(geof:ST_GeomFromText(?shape,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.

FunctionDescription
ST_ReadSHPReturns geometry objects extracted from a Shapefile shape (SHP) format file.
ST_ReadKMLReturns geometry objects extracted from a Keyhole Markup Language (KML) file.
ST_ReadGeoJSONReturns geometry objects extracted from a JSON format file.
ST_ReadTextReturns geometry objects extracted from a Well-Known Text (WKT) file.
ST_ReadGMLReturns geometry objects extracted from a Geography Markup Language (GML) format file.
ST_ReadWKBReturns 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.

ArgumentData TypeDescription
filePathxsd: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.

ArgumentData TypeDescription
filePathxsd: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.

ArgumentData TypeDescription
filePathxsd: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.

ArgumentData TypeDescription
filePathxsd: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.

ArgumentData TypeDescription
filePathxsd: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.

ArgumentData TypeDescription
filePathxsd: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') {} 
}