Skip to content

Extending Apache jena with more geospatial functions

License

Notifications You must be signed in to change notification settings

i3mainz/jena-geo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jena-geo

This implementation extends the ARQ query processor of Apache Jena GeoSPARQL with further functions to support geometry operations. This implementation builds upon and extends work by Greg Albiston:

https://github.com/galbiston/geosparql-jena

Please also visit the sister projects of this implementation with aim for similar implementations for RDF4J and Apache Marmotta:

Testbench:

https://www.i3mainz.de/projekte/semgis/postgis-jena/

Extensions of geospatial support

The main contribution of this implementation is the provision of further geospatial processing functions which are available in comparable relational database implementations such as POSTGIS or Oracle Spatial but not yet in a Semantic Web implementation. Particular focus is given to highlight the compatibility of given functions with raster/coverage data representations. The status of the implementation is highlighted in the respective columns of the tables. Eventual goal is the implementation of most coverage/raster specific functions used in comparable non-semantic implementations which may or may not become part of a new standardization process involving GeoSPARQL. The implementation can be tested using the provided JUnit tests. A deployment of the service is currently not available.

Spatial Aggregate Functions

Spatial aggregate functions define aggregate functions which can be applied to geometry and coverage literals.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_AVGX xsd:double Calculates the aggregate of all given X coordinate values Aggregate No Todo Yes
geo2:ST_AVGXDistinct xsd:double Calculates the aggregate of all given distinct X coordinate values Aggregate No Todo Yes
geo2:ST_AVGY xsd:double Calculates the aggregate of all given Y coordinate values Aggregate No Todo Yes
geo2:ST_AVGYDistinct xsd:double Calculates the aggregate of all given Y coordinate values Aggregate No Todo Yes
geo2:ST_AVGZDistinct xsd:double Calculates the aggregate of all given Z coordinate values Aggregate No Todo Yes
geo2:ST_BoundingBox sf:Geometry Calculates an aggergate boundingbox of all given geometries Aggregate No Todo Yes
geo2:ST_BoundingBoxDistinct sf:Geometry Calculates an aggregate boundingbox of all given distinct geometries Aggregate No Todo No
geo2:ST_MaxX xsd:double Calculates the maximum X coordinate of all given geometries Aggregate No Todo Yes
geo2:ST_MaxY xsd:double Calculates the maximum Y coordinate of all given geometries Aggregate No Todo Yes
geo2:ST_MaxZ xsd:double Calculates the maximum Z coordinate of all given geometries Aggregate No Todo Yes
geo2:ST_MinX xsd:double Calculates the minimum X coordinate of all given geometries Aggregate No Todo Yes
geo2:ST_MinXDistinct xsd:double Calculates the minimum X coordinate of all distinct given geometries Aggregate No Todo Yes
geo2:ST_MinY xsd:double Calculates the minimum Y coordinate of all given geometries Aggregate No Todo No
geo2:ST_MinYDistinct xsd:double Calculates the minimum Y coordinate of all distinct given geometries Aggregate No Todo Yes
geo2:ST_MinZ xsd:double Calculates the minimum Z coordinate of all given geometries Aggregate No Todo No
geo2:ST_MinZDistinct xsd:double Calculates the minimum Z coordinate of all distinct given geometries Aggregate No Todo Yes

Geometries

This section defines additional functions for vector geometries which are supported by the implementation. If functions from GeoSPARQL are reimplemented they are marked as such. If functions may also relate vector geometries to raster data, they are marked as such. Functions which are not fully implemented or unstable are marked in the table.

Geometry Literals

This implementation supports the following geometry literal types:

Planned further implementations:

Geometry Attribute Functions

These functions return attributes of a given vector or raster literal which may be used e.g. in SPARQL FILTER expressions.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_Area (sf:Geometry geom) xsd:double Calculates the area of the geometry Attribute No Yes Yes
geo2:ST_Area3D (sf:Geometry geom) xsd:double Calculates the area of a 3d geometry Attribute No Todo No
geo2:ST_Boundary (sf:Geometry geom) sf:LineString Calculates the boundary of a geometry Attribute Yes Yes Yes
geo2:ST_BoundingDiagonal (sf:Geometry geom) sf:LineString Calculates the bounding diagonal of a geometry Attribute No Todo Yes
geo2:ST_Centroid (sf:Geometry geom) sf:Point Calculates the centroid of a geometry Attribute No Todo Yes
geo2:ST_CompactnessRatio (sf:Geometry geom) xsd:double Calculates the compactness ratio of a geometry Attribute No N/A Yes
geo2:ST_ConcaveHull (sf:Geometry geom) sf:Geometry Calculates the concave hull of a geometry Attribute No Todo Yes
geo2:ST_ConvexHull (sf:Geometry geom) sf:Geometry Calculates the convex hull of a geometry Attribute No Todo Yes
geo2:ST_Dimension (sf:Geometry geom) xsd:double Calculates the dimension of the given geometry Attribute No Todo Yes
geo2:ST_GeometryN (sf:Geometry geom) sf:Geometry Returns the nth geometry of a Geometry Collection Attribute No N/A Yes
geo2:ST_GeometryType (sf:Geometry geom) xsd:string Returns the type of a the given Geometry Attribute No Todo Yes
geo2:ST_HasHorizontalCRS (sf:Geometry geom) xsd:boolean Indicates whether the CRS of the given geometry is horizontal Attribute No Todo Yes
geo2:ST_HasRepeatedPoints (sf:Geometry geom) xsd:boolean Indicates whether geometry has repeated coordinates Attribute No No Yes
geo2:ST_InteriorPoint (sf:Geometry geom) sf:Point Returns a point guaranteed to be covered by the geometry Attribute No Todo Yes
geo2:ST_Is3D (sf:Geometry geom) xsd:boolean Indicates whether the given geometry is a 3D geometry Attribute No Todo Yes
geo2:ST_IsCollection (sf:Geometry geom) xsd:boolean Indicates whether the given geometry is a GeometryCollection Attribute No N/A Yes
geo2:ST_IsInCRSAreaOfValidity (sf:Geometry geom) xsd:boolean Indicates whether the point is in a valid area defined by its CRS Attribute No N/A Yes
geo2:ST_IsMeasured (sf:Geometry geom) xsd:boolean Indicates whether the geometry contains a measurement coordinate Attribute No N/A Yes
geo2:ST_IsPlanar (sf:Geometry geom) xsd:boolean Indicates whether the geometry is 2D Attribute No N/A Yes
geo2:ST_IsRectangle (sf:Geometry geom) xsd:boolean Indicates whether the geometry is a rectangle Attribute No N/A Yes
geo2:ST_IsSolid (sf:Geometry geom) xsd:boolean Indicates whether the geometry is 3D (see also geo2:ST_Is3D) Attribute No N/A Yes
geo2:ST_IsSquare (sf:Geometry geom) xsd:boolean Indicates whether the geometry is a square Attribute No N/A Yes
geo2:ST_IsValidDetail (sf:Geometry geom) xsd:string Indicates whether the geometry is valid and the invlid part of the geometry as a String on error Attribute No N/A Yes
geo2:ST_IsValidReason (sf:Geometry geom) xsd:string Indicates whether the geometry is valid, returns a reason for this assessment Attribute No N/A Yes
geo2:ST_Length (sf:Geometry geom) xsd:double Indicates whether the length of the geometry Attribute No Todo Yes
geo2:ST_Length3D (sf:Geometry geom) xsd:double Indicates whether the 3d length of the geometry Attribute No Todo Yes
geo2:ST_MinimumBoundingCircle (sf:Geometry geom) sf:Geometry Returns the miminum bounding circle of the given geometry Attribute No Todo Yes
geo2:ST_MinimumBoundingCircleCenter (sf:Geometry geom) sf:Point Returns the center point of the miminum bounding circle of the given geometry Attribute No Todo Yes
geo2:ST_MinimumBoundingCircleRadius (sf:Geometry geom) xsd:double Returns the radius of the miminum bounding circle of the given geometry Attribute No Todo Yes
geo2:ST_MinimumClearance (sf:Geometry geom) xsd:double Returns the miminum clearance of the given geometry Attribute No Todo Yes
geo2:ST_MinimumClearanceLine (sf:Geometry geom) sf:LineString Returns the miminum clearance line of the given geometry Attribute No Todo Yes
geo2:ST_MinimumDiameter (sf:Geometry geom) xsd:double Returns the miminum diameter of the given geometry Attribute No Todo Yes
geo2:ST_MinimumDiameterLine (sf:Geometry geom) sf:LineString Returns the miminum diameter line of the given geometry Attribute No Todo Yes
geo2:ST_MinimumRectangle (sf:Geometry geom) sf:Geometry Returns the miminum rectangle around the given geometry Attribute No Todo Yes
geo2:ST_NDims (sf:Geometry geom) xsd:integer Returns the number of dimensions for a given geometry Attribute No N/A Yes
geo2:ST_NumDistinctGeometries (sf:Geometry geom) xsd:integer Returns the number of distinct geometries of the given geometry literal Attribute No N/A Yes
geo2:ST_NumDistinctPoints (sf:Geometry geom) xsd:integer Returns the number of distinct points of the given geometry literal Attribute No N/A Yes
geo2:ST_NumGeometries (sf:Geometry geom) xsd:integer Returns the number of geometries of the given geometry literal Attribute No N/A Yes
geo2:ST_NumPatches (sf:Geometry geom) xsd:integer Returns the number of patches of the given geometry literal Attribute No N/A No
geo2:ST_NumPoints (sf:Geometry geom) xsd:integer Returns the number of points of the given geometry literal Attribute No N/A Yes
geo2:ST_PatchN (sf:Geometry geom) xsd:integer Returns the nth patch of the given geometry literal Attribute No N/A No
geo2:ST_Perimeter (sf:Geometry geom) xsd:integer Returns the perimeter of the given geometry literal Attribute No Todo Yes
geo2:ST_Perimeter3D (sf:Geometry geom) xsd:integer Returns the 3d perimeter of the given geometry literal Attribute No Todo No
geo2:ST_PointN (sf:Geometry geom) xsd:integer Returns the nth point of the given geometry literal Attribute No N/A No
geo2:ST_PointOnSurface (sf:Geometry geom) xsd:integer Returns a point guaranteed to lie on the surface of the given geometry literal Attribute No Todo No

Geometry BoundingBox (Envelope) Functions

These functions work with boundingboxes (envelopes) of geometries and raster geometries of raster data. All functions are compatible with raster representations. They may be for example be used in SPARQL FILTER expressions.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_BBOXAbove (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is completely above the boundingbox of literal two. Relation No Yes Yes
geo2:ST_BBOXBelow (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is completely below the boundingbox of literal two. Relation No Yes Yes
geo2:ST_BBOXContains (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is completely contains the boundingbox of literal two. Relation No Yes Yes
geo2:ST_BBOXEquals (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one equals the boundingbox of literal two. Relation No Yes Yes
geo2:ST_BBOXFPIntersects (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one intersects the boundingbox of literal two measuring with floating point precision. Relation No Yes Yes
geo2:ST_BBOXIntersects (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one intersects the boundingbox of literal two. Relation No Yes Yes
geo2:ST_BBOXIsContainedBy (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is completely contained by the boundingbox of literal two. Relation No Yes Yes
geo2:ST_BBOXLeftOf (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is completely left of the boundingbox of literal two. Relation No Yes Yes
geo2:ST_BBOXOverlapsAbove (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is above of the boundingbox of literal two but overlaps with it. Relation No Yes Yes
geo2:ST_BBOXOverlapsBelow (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is below of the boundingbox of literal two but overlaps with it. Relation No Yes Yes
geo2:ST_BBOXOverlapsLeft (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is left of the boundingbox of literal two but overlaps with it. Relation No Yes Yes
geo2:ST_BBOXOverlapsRight (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is right of the boundingbox of literal two but overlaps with it. Relation No Yes Yes
geo2:ST_BBOXRightOf (sf:Geometry geom) xsd:boolean Indicates if the boundingbox of literal one is completely right of the boundingbox of literal two. Relation No Yes Yes

Geometry Constructors

These functions create vector literal representations from Strings.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_GeomFromGeoJSON (xsd:string input) sf:Geometry Returns the parsed geometry from a GeoJSON String. Constructor No N/A Yes
geo2:ST_GeomFromGML (xsd:string input) sf:Geometry Returns the parsed geometry from a GML String. Constructor No N/A Yes
geo2:ST_GeomFromKML (xsd:string input) sf:Geometry Returns the parsed geometry from a KML String. Constructor No N/A Yes
geo2:ST_GeomFromText (xsd:string input) sf:Geometry Returns the parsed geometry from a WKT String. Constructor No N/A Yes
geo2:ST_GeomFromWKB (xsd:string input) sf:Geometry Returns the parsed geometry from a WKB String. Constructor No N/A Yes

Geometry Editor Functions

These functions manipulate vector geometry literals. They are not applicable to raster literals.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_AddGeometry (sf:Geometry geom,sf:Geometry toadd) sf:Geometry Returns a GeometryCollection with the added Geometry. Editor No N/A Yes
geo2:ST_EnsureClosed (sf:Geometry geom) sf:Geometry Returns a closed Geometry. Editor No N/A Yes
geo2:ST_RemoveGeometry (sf:Geometry geom,xsd:integer position) sf:Geometry Returns a GeometryCollection with a removed Geometry at a given position. Editor No N/A Yes
geo2:ST_RemoveRepeatedPoints (sf:Geometry geom,xsd:double tolerance) sf:Geometry Returns a Geometry with repeated points remove according to a given tolerance. Editor No N/A Yes
geo2:ST_SetGeometry (sf:Geometry geom,xsd:integer position) sf:Geometry Sets a geometry at the given position of the GeometryCollection. Editor No N/A Yes

Geometry Exporter Functions

These functions convert vector literals to other geospatial vector data formats. These functions are applicable to rasters if they were vectorized beforehand.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_AsBinary (sf:Geometry geom) xsd:string Returns a Well-Known-Binary representation of the given geometry . Export No N/A Yes
geo2:ST_AsGeoJSON (sf:Geometry geom) xsd:string Returns a GeoJSON representation of the given geometry . Export No N/A Yes
geo2:ST_AsGeoURI (sf:Geometry geom) xsd:string Returns a GeoURI representation of the given geometry or of its centroid if not a point . Export No N/A Yes
geo2:ST_AsGML (sf:Geometry geom) xsd:string Returns a GML representation of the given geometry. Export No N/A Yes
geo2:ST_AsGPX (sf:Geometry geom) xsd:string Returns a GPX representation of the given geometry. Export No N/A Yes
geo2:ST_AsKML (sf:Geometry geom) xsd:string Returns a KML representation of the given geometry. Export No N/A Yes
geo2:ST_AsLatLonText (sf:Geometry geom) xsd:string Returns a Latitude/Longitude text representation of the given geometry. Export No N/A Yes
geo2:ST_AsText (sf:Geometry geom) xsd:string Returns a Well-Known-Text representation of the given geometry. Export No N/A Yes
geo2:ST_AsTextRound (sf:Geometry geom, xsd:double tolerance) xsd:string Returns a Well-Known-Text representation of the given geometry with rounded coordinates according to the second parameter. Export No N/A Yes
geo2:ST_AsTWKB (sf:Geometry geom) xsd:string Returns a Tiny Well-Known-Binary representation of the given geometry. Export No N/A Yes
geo2:ST_Dump (sf:Geometry geom) xsd:string Returns a list of space delimited geometry literals. Export No N/A Yes
geo2:ST_DumpPoints (sf:Geometry geom) xsd:string Returns a list of space delimited geometry literals of the points included in the given geometries. Export No N/A Yes

Geometry/Raster Relation Functions

These functions relate vector literals to other vector literals and/or raster data.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_AreaSimilarity (sf:Geometry geom, sf:Geometry geom2) xsd:double Returns the area similarity score of two vector geometry literals. Relation No Todo Yes
geo2:ST_CentroidDistance (sf:Geometry geom, sf:Geometry geom2) xsd:double Returns the centroid distance between two geometry literals. Relation No Todo Yes
geo2:ST_ClosestCoordinate (sf:Geometry geom, sf:Geometry geom2) sf:Geometry Returns the closest coordinate between two geometry literals. Relation No Todo Yes
geo2:ST_Contains (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the first geometry contains the second. Relation Yes Yes Yes
geo2:ST_ContainsProperly (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the first geometry properly contains the second. Relation Yes Yes Yes
geo2:ST_CoveredBy (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the first geometry is covered by the second. Relation Yes Yes Yes
geo2:ST_Covers (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the first geometry covers the second. Relation Yes Yes Yes
geo2:ST_Crosses (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the first geometry crosses the second. Relation Yes Yes Yes
geo2:ST_DFullyWithin (sf:Geometry geom, sf:Geometry geom2, xsd:double distance) xsd:boolean Returns true if geometry literal one is fully within a given distance of geometry literal two. Relation Yes Todo Yes
geo2:ST_Disjoint (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the first geometry and second geometry are disjoint. Relation Yes Yes Yes
geo2:ST_Distance (sf:Geometry geom, sf:Geometry geom2) xsd:double Returns the distance between two geometry literals. Relation Yes Yes Yes
geo2:ST_DistanceSphere (sf:Geometry geom, sf:Geometry geom2) xsd:double Returns the spheroid distance between two geometry literals. Relation Yes Yes Yes
geo2:ST_DWithin (sf:Geometry geom, sf:Geometry geom2, xsd:double distance) xsd:boolean Returns true if geometry literal one is within a given distance of geometry literal two. Relation Yes Todo Yes
geo2:ST_Equals (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the two geometries are equal. Relation No Yes Yes
geo2:ST_EqualNorm (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the two geometries are equal in their normalized form. Relation No Yes Yes
geo2:ST_EqualSRS (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the two geometries are using the same spatial reference system. Relation No Yes Yes
geo2:ST_EqualTopo (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the two geometries are topologically equal. Relation No Yes Yes
geo2:ST_EqualType (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the two geometry types are equal. Relation No Yes Yes
geo2:ST_FrechetDistance (sf:Geometry geom, sf:Geometry geom2) xsd:double Returns the Frechet Distance between two geometries. Relation No Todo Yes
geo2:ST_Intersection (sf:Geometry geom, sf:Geometry geom2) sf:Geometry Calculates the intersection between two geometries. Relation No Yes Yes
geo2:ST_Intersects (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the two geometries intersect. Relation No Yes Yes
geo2:ST_IntersectionMatrix (sf:Geometry geom, sf:Geometry geom2) xsd:string Returns the intersection matrix between to geometries. Relation No Todo Yes
geo2:ST_IntersectionPercentage (sf:Geometry geom, sf:Geometry geom2) xsd:double Returns the intersection matrix between to geometries. Relation No Yes Yes
geo2:ST_MaxDistance (sf:Geometry geom, sf:Geometry geom2) xsd:double Returns the distance between the most distance coordinates of the two given geometries. Relation No Yes Yes
geo2:ST_MaxDistance3D (sf:Geometry geom, sf:Geometry geom2) xsd:double Returns the distance between the most distance coordinates of the two given 3d geometries. Relation No Todo Yes
geo2:ST_Overlaps (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the two geometries overlap. Relation No Yes Yes
geo2:ST_ShortestLine (sf:Geometry geom, sf:Geometry geom2) sf:LineString Returns the shortest line between two geometries. Relation No Todo Yes
geo2:ST_ShortestLine3D (sf:Geometry geom, sf:Geometry geom2) sf:LineString Returns the shortest line between two 3d geometries. Relation No Todo No
geo2:ST_Touches (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the two geometries touch each other. Relation No Yes Yes
geo2:ST_Union (sf:Geometry geom, sf:Geometry geom2) sf:Geometry Returns the union of two geometries. Relation No Yes Yes
geo2:ST_Within (sf:Geometry geom, sf:Geometry geom2) xsd:boolean Returns true if the first geometry is within the second geometry. Relation No Yes Yes

Geometry Transformation Functions

These functions transform vector literals according to the specified function. They are mostly not applicable to raster data.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_CollectionExtract (sf:Geometry geom,xsd:string type) sf:Geometry Returns a GeometryCollection version of the given geometry. Transformation No N/A Yes
geo2:ST_CollectionHomogenize (sf:Geometry geom) sf:Geometry Returns the simplest representation of a given geometry. Transformation No N/A Yes
geo2:ST_Densify (sf:Geometry geom, xsd:double tolerance) sf:Geometry Returns a densified version of the given geometry. Transformation No N/A Yes
geo2:ST_FlipCoordinates (sf:Geometry geom) sf:Geometry Returns a given geometry with the X/Y axis flipped. Transformation No N/A Yes
geo2:ST_Force2D (sf:Geometry geom) sf:Geometry Returns a 2D representation of a given geometry. Transformation No N/A Yes
geo2:ST_Force3D (sf:Geometry geom) sf:Geometry Returns a 3D representation of a given geometry. Transformation No N/A Yes
geo2:ST_Force3DM (sf:Geometry geom) sf:Geometry Returns a 3DM representation of a given geometry. Transformation No N/A Yes
geo2:ST_Force4D (sf:Geometry geom) sf:Geometry Returns a 4D representation of a given geometry. Transformation No N/A Yes
geo2:ST_ForceCollection (sf:Geometry geom) sf:Geometry Returns a gepometry collection of a given geometry. Transformation No N/A Yes
geo2:ST_Multi (sf:Geometry geom) sf:Geometry Returns a "Multi" version of the given geometry if applicable. Transformation No N/A Yes
geo2:ST_Normalize (sf:Geometry geom) sf:Geometry Returns a normalized version of the given geometry. Transformation No N/A Yes
geo2:ST_PrecisionReducer (sf:Geometry geom, xsd:double precisionvalue) sf:Geometry Returns a version of the given geometry with reduced precision. Transformation No N/A Yes
geo2:ST_Reverse (sf:Geometry geom) sf:Geometry Returns a geometry with reverse coordinates. Transformation No N/A Yes
geo2:ST_Simplify (sf:Geometry geom) sf:Geometry Returns a simplified geometry according to the Douglas-Peucker algorithm. Transformation No N/A Yes
geo2:ST_SimplifyPreserveTopology (sf:Geometry geom) sf:Geometry Returns a simplified geometry preserving its topology. Transformation No N/A Yes
geo2:ST_SimplifyVW (sf:Geometry geom) sf:Geometry Returns a simplified geometry calculated with the Visvalingam-Whyatt algorithm. Transformation No N/A Yes
geo2:ST_SwapOrdinates (sf:Geometry geom, xsd:string ordinatecode) sf:Geometry Swaps ordinate values according to a given ordinate String code. Transformation No N/A Yes

LineString Functions

These functions are applicable to LineString representations only and cannot be used with raster literals or other types of Geometries.

LineString Attribute Functions
These functions return LineString specific attributes.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_EndPoint (sf:Geometry geom) sf:Point Returns the last point in the given LineString. Attribute No N/A Yes
geo2:ST_IsClosed (sf:Geometry geom) xsd:boolean Indicates if the LineString is closed, i. e. its first and last point are the same. Attribute No N/A Yes
geo2:ST_SelfIntersections (sf:Geometry geom) sf:Geometry Returns a MultiPoint of self intersections of the LineString. Attribute No N/A Yes
geo2:ST_StartPoint (sf:Geometry geom) sf:Point Returns the first point in the given LineString. Attribute No N/A Yes

Point Functions

These functions are connected to point or coordinate representations of geometries and cannot mostly not be used with raster literals or other types of Geometries.

Point Attribute Functions
These functions return Point or coordinate specific attributes of geometries.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_M (sf:Geometry geom) xsd:double Returns the M coordinate of the given point. Attribute No N/A Yes
geo2:ST_MMax (sf:Geometry geom) xsd:double Returns the minimum M coordinate of the given geometry. Attribute No N/A Yes
geo2:ST_MMin (sf:Geometry geom) xsd:double Returns the maximum M coordinate of the given geometry. Attribute No N/A Yes
geo2:ST_X (sf:Geometry geom) xsd:double Returns the X coordinate of the given point. Attribute No N/A Yes
geo2:ST_XMax (sf:Geometry geom) xsd:double Returns the maximum X coordinate of the given geometry. Attribute No N/A Yes
geo2:ST_XMin (sf:Geometry geom) xsd:double Returns the minimum X coordinate of the given geometry. Attribute No N/A Yes
geo2:ST_Y (sf:Geometry geom) xsd:double Returns the Y coordinate of the given point. Attribute No N/A Yes
geo2:ST_YMax (sf:Geometry geom) xsd:double Returns the maximum Y coordinate of the given geometry. Attribute No N/A Yes
geo2:ST_YMin (sf:Geometry geom) xsd:double Returns the minimum Y coordinate of the given geometry. Attribute No N/A Yes
geo2:ST_Z (sf:Geometry geom) xsd:double Returns the Z coordinate of the given point. Attribute No N/A Yes
geo2:ST_ZMax (sf:Geometry geom) xsd:double Returns the maximum Z coordinate of the given geometry. Attribute No N/A Yes
geo2:ST_ZMin (sf:Geometry geom) xsd:double Returns the minimum Z coordinate of the given geometry. Attribute No N/A Yes
Point Constructor Functions
These functions return Point specific attributes.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_GeneratePoints (sf:Geometry geom, xsd:integer amount) sf:Geometry Generates a MulitPoint geometry with the amount of points given as a parameter in the area of the geometry given in the first parameter. Constructor No N/A Yes
geo2:ST_MakePoint (xsd:double .... coords) sf:Point Creates a point from the given ordinate values. Constructor No N/A Yes
geo2:ST_MakePointM (xsd:double x, xsd:double y, xsd:double z) sf:Point Creates a measurement point from the given ordinate values. Constructor No N/A Yes
geo2:ST_PointFromText (xsd:string wkt) sf:Point Creates a Point from a given WKT string. Constructor No N/A Yes
geo2:ST_PointFromWKB (xsd:string wkt) sf:Point Creates a Point from a given WKB string. Constructor No N/A Yes

Polygon Functions

These functions are applicable to Polygon representations only and cannot be used with raster literals or other types of Geometries.

Polygon Attribute Functions
These functions return LineString specific attributes.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_CircularityIndex (sf:Geometry geom) xsd:double Calculates the circularity index of the Polygon. Attribute No N/A Yes
geo2:ST_Circumcentre (sf:Geometry geom) sf:Point Returns the circumcentre of the Polygon. Attribute No N/A Yes
geo2:ST_ExteriorRing (sf:Geometry geom) sf:Geometry Returns the exterior ring of the Polygon. Attribute No N/A Yes
geo2:ST_HasDuplicateRings (sf:Geometry geom) xsd:boolean Indicates if the polygon has duplicate rings. Attribute No N/A Yes
geo2:ST_InteriorRingN (sf:Geometry geom, xsd:integer ringnum) sf:Geometry Returns the nth interior ring of the Polygon. Attribute No N/A Yes
geo2:ST_IsAcute (sf:Geometry geom) xsd:boolean Indicates if the polygon is acute. Attribute No N/A Yes
geo2:ST_IsConvex (sf:Geometry geom) xsd:boolean Indicates if the polygon is convex. Attribute No N/A Yes
geo2:ST_IsEquilateralTriangle (sf:Geometry geom) xsd:boolean Indicates if the polygon is an equilateral triangle. Attribute No N/A Yes
geo2:ST_IsIsocelesTriangle (sf:Geometry geom) xsd:boolean Indicates if the polygon is an isoceles triangle. Attribute No N/A Yes
geo2:ST_IsPointedTriangle (sf:Geometry geom) xsd:boolean Indicates if the polygon is a pointed triangle. Attribute No N/A Yes
geo2:ST_IsRightTriangle (sf:Geometry geom) xsd:boolean Indicates if the polygon is a right triangle. Attribute No N/A Yes
geo2:ST_IsScaleneTriangle (sf:Geometry geom) xsd:boolean Indicates if the polygon is a scalene triangle. Attribute No N/A Yes
geo2:ST_IsTriangle (sf:Geometry geom) xsd:boolean Indicates if the polygon is a triangle. Attribute No N/A Yes
geo2:ST_NRings (sf:Geometry geom) xsd:integer Returns the number of rings of the polygon. Attribute No N/A Yes
geo2:ST_NumInteriorRings (sf:Geometry geom) xsd:integer Returns the number of interior rings of the polygon. Attribute No N/A Yes
Polygon Constructor Functions
These functions create Polygons from String representations.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_PolygonFromText (xsd:string text) sf:Polygon Parses a polygon from a given WKT string. Editor No N/A Yes
geo2:ST_PolygonFromWKB (xsd:string text) sf:Polygon Parses a polygon from a given WKB string. Editor No N/A Yes
Polygon Editor Functions
These functions modify Polygon representations.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_AddRing (sf:Polygon geom, sf:LineString ring) sf:Polygon Adds a ring to the given Polygon. Editor No N/A Yes
geo2:ST_RemoveRing (sf:Polygon geom, xsd:integer ringnum) sf:Polygon Removes a ring from the given Polygon. Editor No N/A Yes
geo2:ST_SetRing (sf:Polygon geom, sf:LineString ring, xsd:integer ringnum) sf:Polygon Sets a ring in the given Polygon. Editor No N/A Yes

Coordinate Reference System Functions

These functions are applicable to raster and vector data as they aim to deal with their coordinate reference system.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_EPSGToSRID (xsd:string epsg) xsd:integer Converts an EPSG CRS representation to an SRID representation. SRID No Yes Yes
geo2:ST_SetSRID (sf:Geometry geom, xsd:string epsg) xsd:integer Sets the SRID of a given literal. SRID No Yes Yes
geo2:ST_GetAxis1Name (sf:Geometry geom) xsd:string Returns the name of the first axis of the CRS. SRID No Yes Yes
geo2:ST_GetAxis1Orientation (sf:Geometry geom) xsd:string Returns the orientation of the first axis of the CRS. SRID No Yes Yes
geo2:ST_GetAxis2Name (sf:Geometry geom) xsd:string Returns the name of the second axis of the CRS. SRID No Yes Yes
geo2:ST_GetAxis2Orientation (sf:Geometry geom) xsd:string Returns the orientation of the second axis of the CRS. SRID No Yes Yes
geo2:ST_SRIDHasFlippedAxis (sf:Geometry geom) xsd:boolean Indicates if the SRID exhibits a flipped axis. SRID No Yes Yes
geo2:ST_SRIDToEPSG (xsd:integer srid) xsd:string Converts an SRID CRS representation to an EPSG representation. SRID No Yes Yes

Raster/Coverage support

This section introduces supported raster/coverage functions.

Raster literals

This section includes raster literals which have been (partially) implemented. For now all given JUnit tests use the RasterHexWKB Format because of its ease of usage in JUnit tests and because of its compact representation. However, other literal types provide other opportunities for representing raster data. CoverageJSON is an emerging way to publish raster data, GeoTIFF may be used in already established OGC web services such as Web Map Services.

Planned further implementations:

Raster Attribute Functions

These functions returns attributes of a coverage/raster. They are not applicable to vector data. All rasters implemented assume one raster band by default, even though many raster bands may be supported in raster literals.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_Envelope (geo2:Raster rast) sf:Geometry Returns the envelope/minimum bounding box of the given raster. Attribute No Yes Yes
geo2:ST_HasNoBand (geo2:Raster rast, xsd:integer bandnum=1) xsd:boolean Returns true if a raster band of the given number exists, false otherwise. Attribute No Yes Yes
geo2:ST_Height (geo2:Raster rast) xsd:double Returns the height of the given raster. Attribute No Yes Yes
geo2:ST_IsEmpty (geo2:Raster rast) xsd:boolean Returns if the raster contains atomic values. Attribute No Yes Yes
geo2:ST_MaxValue (geo2:Raster rast, xsd:integer bandnum=1) xsd:double Returns the maximum atomic value of the given raster band. Attribute No Yes Yes
geo2:ST_MinValue (geo2:Raster rast, xsd:integer bandnum=1) xsd:double Returns the minimum atomic value of the given raster band. Attribute No Yes Yes
geo2:ST_NumBands (geo2:Raster rast) xsd:integer Returns the number of raster bands of the given raster. Attribute No Yes Yes
geo2:ST_NumXTiles (geo2:Raster rast) xsd:integer Returns the number of X tiles of the given raster. Attribute No Yes Yes
geo2:ST_NumYTiles (geo2:Raster rast) xsd:integer Returns the number of Y tiles of the given raster. Attribute No Yes Yes
geo2:ST_Value (geo2:Raster rast, xsd:integer bandnum=1, xsd:integer col, xsd:integer row) xsd:double Returns the atomic value in the given column/row of the raster. Attribute No Yes Yes
geo2:ST_Width (geo2:Raster rast) xsd:double Returns the height of the given raster. Attribute No Yes Yes

Raster Algebra Functions

These functions implemeent raster/map algebra operations.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_Add (geo2:Raster rast, geo2:Raster rast, xsd:integer bandnum=1, xsd:integer bandnum=1) geo2:Raster Returns the sum of the two rasters. Attribute No Yes Yes
geo2:ST_AddConst (geo2:Raster rast, xsd:integer bandnum=1, xsd:double const) geo2:Raster Returns the raster added by a constant value . Attribute No Yes Yes
geo2:ST_And (geo2:Raster rast, geo2:Raster rast, xsd:integer bandnum=1, xsd:integer bandnum=1) geo2:Raster Returns the anded version of the two rasters. Attribute No Yes Yes
geo2:ST_AndConst (geo2:Raster rast, xsd:integer bandnum=1, xsd:double const) geo2:Raster Returns the raster anded by a constant value . Attribute No Yes Yes
geo2:ST_Equal (geo2:Raster rast, geo2:Raster rast2) bandnum=1, xsd:double const) geo2:Raster Keeps raster values which equal . Attribute No Yes No
geo2:ST_Div (geo2:Raster rast, geo2:Raster rast, xsd:integer bandnum=1, xsd:integer bandnum=1) geo2:Raster Returns the divided version of the two rasters. Attribute No Yes Yes
geo2:ST_DivConst (geo2:Raster rast, xsd:integer bandnum=1, xsd:double const) geo2:Raster Returns the raster divided by a constant value . Attribute No Yes Yes
geo2:ST_Mult (geo2:Raster rast, geo2:Raster rast, xsd:integer bandnum=1, xsd:integer bandnum=1) geo2:Raster Returns the multiplied version of the two rasters. Attribute No Yes Yes
geo2:ST_MultConst (geo2:Raster rast, xsd:integer bandnum=1, xsd:double const) geo2:Raster Returns the raster multiplied by a constant value . Attribute No Yes Yes
geo2:ST_Or (geo2:Raster rast, geo2:Raster rast, xsd:integer bandnum=1, xsd:integer bandnum=1) geo2:Raster Returns the or'ed version of the two rasters. Attribute No Yes Yes
geo2:ST_OrConst (geo2:Raster rast, xsd:integer bandnum=1, xsd:double const) geo2:Raster Returns the raster or'ed by a constant value . Attribute No Yes Yes
geo2:ST_Subtract (geo2:Raster rast, geo2:Raster rast, xsd:integer bandnum=1, xsd:integer bandnum=1) geo2:Raster Returns the or'ed version of the two rasters. Attribute No Yes Yes
geo2:ST_SubtractConst (geo2:Raster rast, xsd:integer bandnum=1, xsd:double const) geo2:Raster Returns the raster or'ed by a constant value . Attribute No Yes Yes
geo2:ST_Xor (geo2:Raster rast, geo2:Raster rast, xsd:integer bandnum=1, xsd:integer bandnum=1) geo2:Raster Returns the xor'ed version of the two rasters. Attribute No Yes Yes
geo2:ST_XorConst (geo2:Raster rast, xsd:integer bandnum=1, xsd:double const) geo2:Raster Returns the raster xor'ed by a constant value . Attribute No Yes Yes

Raster Constructors

These functions construct rasters.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_MakeEmptyRaster (xsd:integer width, xsd:integer height, xsd:double upperleftx, xsd:double upperlefty, xsd:double cellsize) geo2:Raster Returns a new raster with sample values according to the given parameters. Attribute No Yes No
geo2:ST_RastFromHexWKB (xsd:string hexwkb) geo2:Raster Returns a new raster parsed from a raster hexwkb string. Attribute No Yes No

Raster Editor Functions

These functions raster export functions.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_AddBand (geo2:Raster rast,xsd:double[] banddata) geo2:Raster Returns the raster with modified nodata value. Attribute No Yes No
geo2:ST_SetBandNoDataValue (geo2:Raster rast,xsd:integer bandnum, xsd:double value) geo2:Raster Returns the raster with modified nodata value. Attribute No Yes Yes

Raster Exporter Functions

These functions raster export functions.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_AsRastHexWKB (geo2:Raster rast) xsd:string Returns the raster in rasterwkb representation. Attribute No Yes Yes

Raster Relation Functions

Raster relation functions relate raster representation to other raster representations or vector geometries. For Raster/Vector relations see also Geometry/Raster relation functions
Function Return Value Description Type In GeoSPARQL? Supports vector? Stable?
geo2:ST_rasterIntersection (geo2:Raster rast, geo2:Raster rast2) geo2:Raster Returns a new resized raster. Attribute No Yes Yes

Raster Transformation Functions

These functions perform transformations on single rasters.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_Rescale (geo2:Raster rast, xsd:integer width, xsd:integer height) geo2:Raster Returns a new rescaled raster. Attribute No Yes No
geo2:ST_Resize (geo2:Raster rast, xsd:integer width, xsd:integer height) geo2:Raster Returns a new resized raster. Attribute No Yes No
geo2:ST_SRID (geo2:Raster rast, xsd:integer srid) geo2:Raster Returns a reprojected raster. Attribute No Yes No

Topology support

This section will include descriptions for topology support which is currently not finished in the given implementation.

Spatiotemporal support

This section will include spatiotemporal support for geometries and possibly rasters. The implementation will begun when the standardization process of GeoSPARQL 2.0 has been matured and decides to include support for spatiotemporal operations.

These functions await standardization and may or may not be removed from the system. In particular they are not stable currently.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_After (geo2:TemporalRange range,geo2:TemporalRange range2) xsd:boolean Returns if the first temporal range lies after the second temporal range. Attribute No N/A Yes
geo2:ST_Before (geo2:TemporalRange range,geo2:TemporalRange range2) xsd:boolean Returns if the first temporal range lies before the second temporal range. Attribute No N/A Yes
geo2:ST_Between (geo2:TemporalRange range,geo2:TemporalRange range2, geo2:TempralRange range3) xsd:boolean Returns if the first temporal range lies in between the second and third temporal range. Attribute No N/A No
geo2:ST_During (geo2:TemporalRange range,geo2:TemporalRange range2, geo2:TempralRange range3) xsd:boolean Returns if the first temporal range lies in between the second and third temporal range. Attribute No N/A No

Utility Functions

Utility functions help to convert units and accompanying information for geospatial data.

Unit Conversion Functions

These functions convert between units beginning from an S/I Base Unit.
Function Return Value Description Type In GeoSPARQL? Supports raster? Stable?
geo2:ST_CentimeterToMeter (xsd:double cm) xsd:double Converts centimeter to meter. Attribute No N/A Yes
geo2:ST_ChainToMeter (xsd:double chain) xsd:double Converts chain to meter. Attribute No N/A Yes
geo2:ST_DecimeterToMeter (xsd:double decimeter) xsd:double Converts decimeter to meter. Attribute No N/A Yes
geo2:ST_FathomToMeter (xsd:double fathom) xsd:double Converts fathom to meter. Attribute No N/A Yes
geo2:ST_FootToMeter (xsd:double foot) xsd:double Converts foot to meter. Attribute No N/A Yes
geo2:ST_InchToMeter (xsd:double inch) xsd:double Converts inch to meter. Attribute No N/A Yes
geo2:ST_KilometerToMeter (xsd:double km) xsd:double Converts kilometer to meter. Attribute No N/A Yes
geo2:ST_LinkToMeter (xsd:double link) xsd:double Converts link to meter. Attribute No N/A Yes
geo2:ST_MeterToCentimeter (xsd:double meter) xsd:double Converts meter to centimeter. Attribute No N/A Yes
geo2:ST_MeterToChain (xsd:double meter) xsd:double Converts meter to chain. Attribute No N/A Yes
geo2:ST_MeterToDecimeter (xsd:double meter) xsd:double Converts meter to decimeter. Attribute No N/A Yes
geo2:ST_MeterToFathom (xsd:double meter) xsd:double Converts meter to fathom. Attribute No N/A Yes
geo2:ST_MeterToFoot (xsd:double meter) xsd:double Converts meter to foot. Attribute No N/A Yes
geo2:ST_MeterToInch (xsd:double meter) xsd:double Converts meter to inch. Attribute No N/A Yes
geo2:ST_MeterToKilometer (xsd:double meter) xsd:double Converts meter to kilometer. Attribute No N/A Yes
geo2:ST_MeterToLink (xsd:double meter) xsd:double Converts meter to link. Attribute No N/A Yes
geo2:ST_MeterToMile (xsd:double meter) xsd:double Converts meter to mile. Attribute No N/A Yes
geo2:ST_MeterToMillimeter (xsd:double meter) xsd:double Converts meter to millimeter. Attribute No N/A Yes
geo2:ST_MeterToNauticalMile (xsd:double meter) xsd:double Converts meter to nautical mile. Attribute No N/A Yes
geo2:ST_MeterToUSFoot (xsd:double meter) xsd:double Converts meter to US foot. Attribute No N/A Yes
geo2:ST_MeterToUSInch (xsd:double meter) xsd:double Converts meter to US inch. Attribute No N/A Yes
geo2:ST_MeterToUSMile (xsd:double meter) xsd:double Converts meter to US mile. Attribute No N/A Yes
geo2:ST_MeterToUSYard (xsd:double meter) xsd:double Converts meter to US yard. Attribute No N/A Yes
geo2:ST_MeterToYard (xsd:double meter) xsd:double Converts meter to yard. Attribute No N/A Yes
geo2:ST_MileToMeter (xsd:double mile) xsd:double Converts mile to meter. Attribute No N/A Yes
geo2:ST_MillimeterToMeter (xsd:double millimeter) xsd:double Converts millimeter to meter. Attribute No N/A Yes
geo2:ST_NauticalMileToMeter (xsd:double mile) xsd:double Converts nautical mile to meter. Attribute No N/A Yes
geo2:ST_USFootToMeter (xsd:double usfoot) xsd:double Converts US foot to meter. Attribute No N/A Yes
geo2:ST_USInchToMeter (xsd:double usinch) xsd:double Converts US inch to meter. Attribute No N/A Yes
geo2:ST_USMileToMeter (xsd:double usmile) xsd:double Converts US mile to meter. Attribute No N/A Yes
geo2:ST_USYardToMeter (xsd:double usyard) xsd:double Converts US yard to meter. Attribute No N/A Yes
geo2:ST_YardToMeter (xsd:double yard) xsd:double Converts yard to meter. Attribute No N/A Yes

GeoSPARQL Ontology extension

The GeoSPARQL ontology has been extended to include support for Coverage representations.

Ontology of functions

An ontology of the planned functions with given URIs has been uploaded to this repository as functions.ttl . The ontology will be appended when the implementation matures and new requirements are considered. The ontology of functions may serve as a template for future standardizations or implementations.

Ontology for modelling geospatial data

The ontology model for the GeoSPARQL extension may be downloaded here: geosparqlplus.ttl In addition to the GeoSPARQL ontology it includes a Coverage class hierarchy and new properties for dealing with raster data.

About

Extending Apache jena with more geospatial functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published