Description
Use Case DSTL01
Transformation Matrices
As a GeoSPARQL data user I would like to transform geometry coordinates using a matrix. Matrix operations can be defined using 2x2 or 3x3 matrices for two- and three-dimensional transformations respectively. Providing a generic matrix based transformation function allows for a comprehensive range of basic geometry operations in 2D or 3D. A generic matrix transformation can be parameterized and used as the basis for a wide range of other functions. Matrices can be multiplied to provide compound transformations.
Transformations can be considered simple and working in cartesian 2D/3D coordinate space only. For more complex transformations on geometries, use eg PROJ.
A matrix based transformation can be used to:
- Translate in two or three dimensions
- Scale along one, two or three axes
- Rotate about any point or axis
- Shear along any axis
- Reflect in any line (2d) or plane (3d)
- Project
- Compound transformation comprising any of the above
Examples:
- scale (in 2d) by k in the x-axis:
- scale (in 2d) by k in the y-axis:
- rotate by angle
$$\Theta$$ about the origin:
- rotate by angle
$$\Theta$$ about an axis defined by a unit vector (x,y,z):
Function signature:
matrixTransform(geometry_in: ogc:geomLiteral, transform: ex:matrix): geometry_out: ogc:geomLiteral
Actor
GeoSPARQL data user (human or software agent querying RDF dataset with GeoSPARQL)
Preconditions
Geometries with 2D or 3D representations are present in a dataset to be queried.
There exists some usable definition of a matrix datatype to be specified as the type to be used for the function parameter transform
. This should be equivalent to the numpy.array or JSON Schema datatypes: eg [[1,0],[0,1]]
and should allow for the specification of MxN matrices, typically 2x2 or 3x3 matrices.
Postconditions
A SPARQL query can be executed that includes a function to return geometry with coordinates transformed from input geometry coordinate using a matrix which specifies a transformation.
Steps
Actor: discovers the matrix transformation function
Actor: executes a SPARQL query containing a matrix transformation function with arguments for a) a geometry and b) a matrix representing the desired transformation.
System: returns a SPARQL result with a geometry object translated from the input geometry using the input matrix.
Activity