http://expath.org/ns/geo ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace geo = "http://expath.org/ns/geo";

Function library providing geo processing using Simple Features api API GMLSF format.
It uses the GEOS third party library, license LGPL. Version 3.2.2 or above is required.

The data format supported is GML SF profile 0/1.
This is a subset of GML, and covers the basic geometries of Point, Line and Surface and collections of those.
GMLSF nodes have the namespace "http://www.opengis.net/gml".

Possible GMLSF geometric structures are:

Point
<gml:Point [srsDimension='2|3']?>
      <gml:pos [srsDimension='2|3']?>double_x double_y </gml:pos>
  </gml:Point>
LineString
<gml:LineString [srsDimension='2|3']?>
      <gml:posList [srsDimension='2|3']?> double_x1 double_y1 double_x2 double_y2 ... </gml:posList>
    </gml:LineString>
Curve
<gml:Curve [srsDimension='2|3']?>
    <gml:segments>
    [<gml:LineStringSegment interpolation="linear" [srsDimension='2|3']?>
       <gml:posList [srsDimension='2|3']?> double_x1 double_y1 double_x2 double_y2 ... </gml:posList>
     <gml:LineStringSegment>]*
    </gml:segments>
    </gml:Curve>
   
LinearRing
<gml:LinearRing [srsDimension='2|3']?>
     <gml:posList [srsDimension='2|3']?> double_x1 double_y1 double_x2 double_y2 ... </gml:posList>
   </gml:LinearRing>
Surface
<gml:Surface [srsDimension='2|3']?>
    <gml:patches>
    [<gml:PolygonPatch [srsDimension='2|3']?>
       <gml:exterior>
         <gml:LinearRing> ... </gml:LinearRing>
       </gml:exterior>
       [<gml:interior>
         <gml:LinearRing> ... </gml:LinearRing>
       </gml:interior>]*
     </gml:PolygonPatch>]*
    </gml:patches>
    </gml:Surface>
  
Polygon
<gml:Polygon [srsDimension='2|3']?>
       <gml:exterior>
         <gml:LinearRing> ... </gml:LinearRing>
       </gml:exterior>
       [<gml:interior>
         <gml:LinearRing> ... </gml:LinearRing>
       </gml:interior>]*
    </gml:Polygon>
  
MultiPoint
<gml:MultiPoint [srsDimension='2|3']?>
       [<gml:Point> ... </gml:Point>]*
    </gml:MultiPoint>
  
MultiCurve
<gml:MultiCurve [srsDimension='2|3']?>
       [<gml:LineString> ... </gml:LineString>]*
    </gml:MultiCurve>
  
MultiSurface
<gml:MultiSurface [srsDimension='2|3']?>
       [<gml:Polygon> ... </gml:Polygon>]*
    </gml:MultiSurface>
  
MultiGeometry (this is from GML 3 schema)
<gml:MultiGeometry [srsDimension='2|3']?>
       [<gml:geometryMember>
               ...one geometry...
       </gml:geometryMember>]*
       [<gml:geometryMembers>
               ...a list of geometries...
       </gml:geometryMembers>]?
    </gml:MultiGeometry>
  


Note: When using gml:posList, it is possible to replace this element with a list of gml:pos.
Note: XLink referencing is not supported.
Note: The srsDimension optional attribute specifies the coordinate dimension. The default value is 2 (for 2D). Another possible value is 3 (for 3D) in which case every point has to have three double values (x, y, z). This is an extension borrowed from GML 3 spec.
The operations made on 3D objects work only on x-y coordinates, the z coordinate is not taken into account. When returning the result, the original z-coordinates of the points are preserved. For computed points, the z-coordinate is interpolated.

The coordinates values have to be in cartesian coordinates, not in polar coordinates.
Converting between coordinate systems and doing projections from polar to cartesian is outside the scope of this geo module.

For operations between two geometries, the DE-9IM matrix is used. The DE-9IM matrix is defined like this:
Interior Boundary Exterior
Interior dim(intersection of interior1 and interior2) dim(intersection of interior1 and boundary2) dim(intersection of interior1 and exterior2)
Boundary dim(intersection of boundary1 and interior2) dim(intersection of boundary1 and boundary2) dim(intersection of boundary1 and exterior2)
Exterior dim(intersection of exterior1 and interior2) dim(intersection of exterior1 and boundary2) dim(intersection of exterior1 and exterior2)

The values in the DE-9IM can be T, F, *, 0, 1, 2 .
- T means the intersection gives a non-empty result.
- F means the intersection gives an empty result.
- * means any result.
- 0, 1, 2 gives the expected dimension of the result (point, curve, surface)


How to build geo module:
- You need GEOS library from here http://trac.osgeo.org/geos/ . Make sure it is version 3.2.2, or better 3.3.0 or above. - After installing or compiling GEOS, on Windows you need to set the cmake variables GEOS_INCLUDE_DIR and GEOS_LIBRARY. On Linux the variables are set automatically by cmake.

Author:

Daniel Turcanu

XQuery version and encoding for this module:

xquery version "1.0" encoding "utf-8";

Module Resources
  • the XQuery module can be found here.
Module Dependencies

External C++ library dependencies:

Related Documentation

For more details please also see:

Namespaces
geo http://expath.org/ns/geo
geo-err http://expath.org/ns/error
gml http://www.opengis.net/gml
ver http://www.zorba-xquery.com/options/versioning
Function Summary
area ( $geometry as element(*) ) as xs:double external
Returns the area of this geometry.
as-binary ( $geometry as element(*) ) as xs:base64Binary external
Return the Well-known Binary Representation of Geometry.
as-text ( $geometry as element(*) ) as xs:string external
Return the Well-known Text Representation of Geometry.
boundary ( $geometry as element(*) ) as element(*)* external
A boundary is a set that represents the limit of an geometry.
bounding-polygons ( $polyhedral-surface as element(gml:Surface), $polygon as element(*) ) as element(gml:PolygonPatch)* external
Return the list of PolygonPatches that share a boundary with the given $polygon.
buffer ( $geometry as element(*), $distance as xs:double ) as element(*) external
Returns a polygon that represents all Points whose distance from this geometric object is less than or equal to distance.
centroid ( $geometry as element(*) ) as element(gml:Point) external
Returns a Point that is the mathematical centroid of this geometry.
contains ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if geometry1 contains geometry2.
convex-hull ( $geometry as element(*) ) as element(*) external
Returns the smallest convex Polygon that contains all the points in the Geometry.
coordinate-dimension ( $geometry as element(*) ) as xs:integer external
Return the coordinate dimension of the geo object, as specified in the srsDimension attribute.
covers ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if geometry1 covers geometry2.
crosses ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if geometry1 crosses geometry2.
difference ( $geometry1 as element(*), $geometry2 as element(*) ) as element(*)? external
Returns a geometric object that represents the Point set difference of geometry1 and geometry2.
dimension ( $geometry as element(*) ) as xs:integer external
Return the dimension of the geo object.
disjoint ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if geometry1 does not touch or intersects geometry2.
distance ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:double external
Compute the shortest distance between any two Points in geometry1 and geometry2.
end-point ( $line as element(*) ) as element(gml:Point) external
Returns the end Point of a line.
envelope ( $geometry as element(*) ) as element(gml:Envelope) external
The envelope is the minimum bounding box of this geometry.
equals ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if the two geometries are equal.
exterior-ring ( $polygon as element(gml:Polygon) ) as element(gml:LinearRing) external
Return the exterior ring of a Polygon.
geometry-n ( $geometry as element(*), $n as xs:unsignedInt ) as element(*) external
Return the n-th geometry in the collection.
geometry-type ( $geometry as element(*) ) as xs:QName? external
Return the qname type of geo object.
interior-ring-n ( $polygon as element(gml:Polygon), $n as xs:unsignedInt ) as element(gml:LinearRing) external
Return the n-th interior ring of a Polygon.
intersection ( $geometry1 as element(*), $geometry2 as element(*) ) as element(*)? external
Returns a geometric object that represents the Point set intersection of geometry1 and geometry2.
intersects ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if geometry1 intersects geometry2.
is-3d ( $geometry as element(*) ) as xs:boolean external
Checks if this geometric object is 2D or 3D, as specified in srsDimension optional attribute.
is-closed ( $geom as element(*) ) as xs:boolean external
Checks if the line is closed loop.
is-empty ( $geometry as element(*)? ) as xs:boolean external
Checks if the argument is empty or not and if it is a valid geometry or not.
is-measured ( $geometry as element(*) ) as xs:boolean external
Checks if this geometric object has measurements.
is-ring ( $line as element(*) ) as xs:boolean external
Checks if the line is a ring.
is-simple ( $geometry as element(*) ) as xs:boolean external
Checks if this geometric object has no anomalous geometric points, such as self intersection or self tangency.
is-within-distance ( $geometry1 as element(*), $geometry2 as element(*), $distance as xs:double ) as xs:boolean external
Checks if geometry2 is within a certain distance of geometry1.
length ( $geometry as element(*) ) as xs:double external
Returns the length of the lines of this geometry.
m ( $point as element(gml:Point) ) as xs:double? external
Should return the Measure of a Point, but is not implemented, because it is not specified in GMLSF.
num-geometries ( $geometry as element(*) ) as xs:unsignedInt external
Return the number of geometries in the collection, or 1 for non-collection.
num-interior-ring ( $polygon as element(gml:Polygon) ) as xs:unsignedInt external
Return the number of interior rings of a Polygon.
num-patches ( $polyhedral-surface as element(gml:Surface) ) as xs:integer external
Return the number of surface patches inside a gml:Surface.
num-points ( $line as element(*) ) as xs:unsignedInt external
Return the number of Points in a line.
overlaps ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if geometry1 overlaps with geometry2.
patch-n ( $polyhedral-surface as element(gml:Surface), $n as xs:unsignedInt ) as element(gml:PolygonPatch) external
Return the n-th Surface patch of a Surface.
point-n ( $line as element(*), $n as xs:unsignedInt ) as element(gml:Point) external
Return the n-th Point in a line.
point-on-surface ( $geometry as element(*) ) as element(gml:Point) external
Returns a Point that is interior of this geometry.
relate ( $geometry1 as element(*), $geometry2 as element(*), $intersection_matrix as xs:string ) as xs:boolean external
Checks if geometry1 relates with geometry2 relative to a DE-9IM matrix.
srid ( $geometry as element(*) ) as xs:anyURI? external
Return the srid URI of geo object.
start-point ( $line as element(*) ) as element(gml:Point) external
Returns the start Point of a line.
sym-difference ( $geometry1 as element(*), $geometry2 as element(*) ) as element(*)? external
Returns a geometric object that represents the Point set symmetric difference of geometry1 and geometry2.
touches ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if geometry1 touches geometry2.
union ( $geometry1 as element(*), $geometry2 as element(*) ) as element(*) external
Returns a geometric object that represents the Point set union of geometry1 and geometry2.
within ( $geometry1 as element(*), $geometry2 as element(*) ) as xs:boolean external
Checks if geometry1 is within geometry2.
x ( $point as element(gml:Point) ) as xs:double external
Returns the X coordinate of a Point.
y ( $point as element(gml:Point) ) as xs:double external
Returns the Y coordinate of a Point.
z ( $point as element(gml:Point) ) as xs:double? external
Returns the Z coordinate of a Point, if is 3D.
Functions
area back to 'Function Summary'
declare function geo:area (
            $geometry as element(*) 
 ) as xs:double external

Returns the area of this geometry.
Returns zero for Point and Lines.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • geometry area as xs:double.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

as-binary back to 'Function Summary'
declare function geo:as-binary (
            $geometry as element(*) 
 ) as xs:base64Binary external

Return the Well-known Binary Representation of Geometry.
This is defined in the Simple Features spec from OGC.
gml:Curve is represented as MultiLineString.
gml:Surface is represented as MultiPolygon.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • the Well-known Binary Representation for the geo object as base64.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

as-text back to 'Function Summary'
declare function geo:as-text (
            $geometry as element(*) 
 ) as xs:string external

Return the Well-known Text Representation of Geometry.
This is defined in the Simple Features spec from OGC.
gml:Curve is represented as MultiLineString.
gml:Surface is represented as MultiPolygon.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • the Well-known Text Representation for the geo object.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

boundary back to 'Function Summary'
declare function geo:boundary (
            $geometry as element(*) 
 ) as element(*)* external

A boundary is a set that represents the limit of an geometry.
For a Point or MultiPoint, the boundary is the empty geometry, nothing is returned.
For a LineString, the boundary is the MultiPoint set of start point and end point.
For a LinearRing, the boundary is empty MultiPoint.
For a Curve, it is treated as a MultiCurve.
For a Polygon, the boundary is the MultiCurve set of exterior and interior rings.
For a Surface, the boundary is the MultiCurve set formed from the exterior ring of all patches seen as a single surface and all the interior rings from all patches.
For MultiCurve, the boundary is the MultiPoint set of all start and end points that appear in an odd number of linestrings.
For MultiGeometry, a sequence of boundaries is returned, corresponding to each child geometry.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:LinearRing, gml:Curve, gml:Polygon, gml:Surface, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • the boundary of a Geometry as a set of Geometries of the next lower dimension.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

bounding-polygons back to 'Function Summary'
declare function geo:bounding-polygons (
            $polyhedral-surface as element(gml:Surface), 
            $polygon as element(*) 
 ) as element(gml:PolygonPatch)* external

Return the list of PolygonPatches that share a boundary with the given $polygon.
The gml:PolygonPatch has the same content as gml:Polygon.
This function tests the exterior ring of each polygon patch if it overlaps with the exterior ring of the given polygon.

Parameters:
  • $polyhedral-surface node of one of GMLSF objects: gml:Surface
  • $polygon, of type gml:Polygon or gml:PolygonPatch
Returns:
  • the list of neibourghing gml:PolygonPatch-es
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

buffer back to 'Function Summary'
declare function geo:buffer (
            $geometry as element(*), 
            $distance as xs:double 
 ) as element(*) external

Returns a polygon that represents all Points whose distance from this geometric object is less than or equal to distance.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $distance the distance from geometry, expressed in units of the current coordinate system
Returns:
  • new geometry surrounding the input geometry.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

centroid back to 'Function Summary'
declare function geo:centroid (
            $geometry as element(*) 
 ) as element(gml:Point) external

Returns a Point that is the mathematical centroid of this geometry. The result is not guaranteed to be on the surface.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • centroid Point.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

contains back to 'Function Summary'
declare function geo:contains (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if geometry1 contains geometry2.
Returns true if within(geometry2, geometry1) is true.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if geometry1 contains geometry2.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

convex-hull back to 'Function Summary'
declare function geo:convex-hull (
            $geometry as element(*) 
 ) as element(*) external

Returns the smallest convex Polygon that contains all the points in the Geometry.
Actually returns the object of smallest dimension possible (possible Point or LineString).

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • the convex polygon node.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

coordinate-dimension back to 'Function Summary'
declare function geo:coordinate-dimension (
            $geometry as element(*) 
 ) as xs:integer external

Return the coordinate dimension of the geo object, as specified in the srsDimension attribute.
Only two-dimensional and three-dimensional coordinates are supported.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • 2 for 2D, 3 for 3D.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

covers back to 'Function Summary'
declare function geo:covers (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if geometry1 covers geometry2.
It has to fulfill one of these conditions:
- every point of geometry2 is a point of geometry1
- the DE-9IM Intersection Matrix for the two geometries is T*****FF* or *T****FF* or ***T**FF* or ****T*FF*.

Unlike contains it does not distinguish between points in the boundary and in the interior of geometries.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if geometry1 covers geometry2.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

crosses back to 'Function Summary'
declare function geo:crosses (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if geometry1 crosses geometry2.
That is if the geometries have some but not all interior points in common. Returns true if the DE-9IM intersection matrix for the two geometries is
T*T****** (for P/L, P/A, and L/A situations)
T*****T** (for L/P, A/P, and A/L situations)
0******** (for L/L situations).

This applies for situations: P/L, P/A, L/L, L/A, L/P, A/P and A/L. For other situations it returns false.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if geometry1 crosses geometry2.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

difference back to 'Function Summary'
declare function geo:difference (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as element(*)? external

Returns a geometric object that represents the Point set difference of geometry1 and geometry2. Points that are in geometry1 and are not in geometry2.
If difference is empty geometry, empty sequence is returned.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • point set geometry node.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

dimension back to 'Function Summary'
declare function geo:dimension (
            $geometry as element(*) 
 ) as xs:integer external

Return the dimension of the geo object.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • 0 for point, 1 for line, 2 for surface.
Errors:
  • geo-err:UnrecognizedGeoObject
Examples:

disjoint back to 'Function Summary'
declare function geo:disjoint (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if geometry1 does not touch or intersects geometry2.
It has to fulfill these conditions:
- they have no point in common
- the DE-9IM Intersection Matrix for the two geometries is FF*FF****.
- geometry1 does not intersect geometry2

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if geometry1 and geometry2 are disjoint.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

distance back to 'Function Summary'
declare function geo:distance (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:double external

Compute the shortest distance between any two Points in geometry1 and geometry2.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • minimum distance as xs:double.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

end-point back to 'Function Summary'
declare function geo:end-point (
            $line as element(*) 
 ) as element(gml:Point) external

Returns the end Point of a line.

Parameters:
  • $line node of one of GMLSF objects: gml:LineString, gml:LinearRing, gml:Curve
Returns:
  • the end gml:Point, constructed with the last coordinates in the line.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

envelope back to 'Function Summary'
declare function geo:envelope (
            $geometry as element(*) 
 ) as element(gml:Envelope) external

The envelope is the minimum bounding box of this geometry.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • An gml:Envelope element with content
    <gml:Envelope>
    <gml:lowerCorner>minx miny</gml:lowerCorner>
    <gml:upperCorner>maxx maxy</gml:upperCorner>
    </gml:Envelope>
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

equals back to 'Function Summary'
declare function geo:equals (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if the two geometries are equal.

Note: Does not work for gml:Surface and gml:MultiSurface if they have multiple Polygons.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if the DE-9IM intersection matrix for the two Geometrys is T*F**FFF*.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

exterior-ring back to 'Function Summary'
declare function geo:exterior-ring (
            $polygon as element(gml:Polygon) 
 ) as element(gml:LinearRing) external

Return the exterior ring of a Polygon.

Parameters:
  • $polygon node of one of GMLSF objects: gml:Polygon
Returns:
  • the original gml:LinearRing node for exterior ring
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

geometry-n back to 'Function Summary'
declare function geo:geometry-n (
            $geometry as element(*), 
            $n as xs:unsignedInt 
 ) as element(*) external

Return the n-th geometry in the collection. Return this geometry if it is not a collection. For gml:Point, gml:LineString, gml:LinearRing, gml:Polygon, return this item if n is zero, otherwise error. For gml:Curve and gml:Surface, they are treated as geometric collections.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $n zero-based index in the collection
Returns:
  • n-th geometry in collection. The node is the original node, not a copy.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

geometry-type back to 'Function Summary'
declare function geo:geometry-type (
            $geometry as element(*) 
 ) as xs:QName? external

Return the qname type of geo object.
Returns empty sequence if the geometry is not recognized.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • "gml:Point" for Point, "gml:LineString" for LineString, "gml:Curve" for Curve, "gml:LineString" for LinearRing, "gml:Surface" for Surface, "gml:Polygon" for Polygon and PolygonPatch, "gml:MultiPoint" for MultiPoint, "gml:MultiCurve" for MultiCurve, "gml:MultiSurface" for MultiSurface, "gml:MultiGeometry" for MultiGeometry
Errors:
  • geo-err:UnrecognizedGeoObject
Examples:

interior-ring-n back to 'Function Summary'
declare function geo:interior-ring-n (
            $polygon as element(gml:Polygon), 
            $n as xs:unsignedInt 
 ) as element(gml:LinearRing) external

Return the n-th interior ring of a Polygon.

Parameters:
  • $polygon node of one of GMLSF objects: gml:Polygon
  • $n index in the list of interior rings, zero based.
Returns:
  • n-th interior ring. The node is the original node, not a copy.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:IndexOutsideRange
  • geo-err:GEOSError
Examples:

intersection back to 'Function Summary'
declare function geo:intersection (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as element(*)? external

Returns a geometric object that represents the Point set intersection of geometry1 and geometry2.
For intersection of two polygons interiors, returns a polygon.
If intersection is void, empty sequence is returned.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • point set geometry node.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

intersects back to 'Function Summary'
declare function geo:intersects (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if geometry1 intersects geometry2.
This is true if disjoint returns false.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if geometry1 and geometry2 are not disjoint.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

is-3d back to 'Function Summary'
declare function geo:is-3d (
            $geometry as element(*) 
 ) as xs:boolean external

Checks if this geometric object is 2D or 3D, as specified in srsDimension optional attribute.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if $geometry is 3D.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

is-closed back to 'Function Summary'
declare function geo:is-closed (
            $geom as element(*) 
 ) as xs:boolean external

Checks if the line is closed loop. That is, if the start Point is same with end Point. For gml:Curve, checks if the start point of the first segment is the same with the last point of the last segment. It also checks that all the segments are connected together, and returns false if they aren't.
For gml:MultiCurve, checks recursively for each LineString.
For gml:Surface, checks if the exterior boundary of each patch touches completely other patches, so the Surface encloses a solid. For this to happen there is a need for 3D objects, and full 3D processing is not supported in GEOS library, so the function always returns false in this case.

Parameters:
  • $geom node of one of GMLSF objects: gml:LineString, gml:LinearRing, gml:Curve, gml:MultiCurve, gml:Surface
Returns:
  • true if the line or surface is closed.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

is-empty back to 'Function Summary'
declare function geo:is-empty (
            $geometry as element(*)? 
 ) as xs:boolean external

Checks if the argument is empty or not and if it is a valid geometry or not.
A geometry is considered empty if it has no points.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if $geometry is not a valid gmlsf object or if is empty.
Errors:
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

is-measured back to 'Function Summary'
declare function geo:is-measured (
            $geometry as element(*) 
 ) as xs:boolean external

Checks if this geometric object has measurements.
Measurements is not supported in this geo module, so the function returns false.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • false.
Errors:
  • geo-err:UnrecognizedGeoObject
Examples:

is-ring back to 'Function Summary'
declare function geo:is-ring (
            $line as element(*) 
 ) as xs:boolean external

Checks if the line is a ring. That is, if the line is closed and simple.

Parameters:
  • $line node of one of GMLSF objects: gml:LineString, gml:LinearRing, gml:Curve
Returns:
  • true if the line is a closed ring.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

is-simple back to 'Function Summary'
declare function geo:is-simple (
            $geometry as element(*) 
 ) as xs:boolean external

Checks if this geometric object has no anomalous geometric points, such as self intersection or self tangency.
Does not work for gml:Surface and gml:MultiGeometry.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:LinearRing, gml:Curve, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface
Returns:
  • true if $geometry is simple.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

is-within-distance back to 'Function Summary'
declare function geo:is-within-distance (
            $geometry1 as element(*), 
            $geometry2 as element(*), 
            $distance as xs:double 
 ) as xs:boolean external

Checks if geometry2 is within a certain distance of geometry1.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $distance the distance from geometry1, expressed in units of the current coordinate system
Returns:
  • true if distance from geometry1 to geometry2 is less than $distance.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

length back to 'Function Summary'
declare function geo:length (
            $geometry as element(*) 
 ) as xs:double external

Returns the length of the lines of this geometry.
Returns zero for Points.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • geometry length as xs:double.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

declare function geo:m (
            $point as element(gml:Point) 
 ) as xs:double? external

Should return the Measure of a Point, but is not implemented, because it is not specified in GMLSF.

Parameters:
  • $point node of one of GMLSF objects: gml:Point
Returns:
  • always empty sequence
Errors:
  • geo-err:UnsupportedSRSDimensionValue
Examples:

num-geometries back to 'Function Summary'
declare function geo:num-geometries (
            $geometry as element(*) 
 ) as xs:unsignedInt external

Return the number of geometries in the collection, or 1 for non-collection. For gml:Point, gml:LineString, gml:LinearRing, gml:Polygon, return 1. For gml:Curve and gml:Surface, they are treated as geometric collections.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • number of geometries in collection
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

num-interior-ring back to 'Function Summary'
declare function geo:num-interior-ring (
            $polygon as element(gml:Polygon) 
 ) as xs:unsignedInt external

Return the number of interior rings of a Polygon.

Parameters:
  • $polygon node of one of GMLSF objects: gml:Polygon
Returns:
  • the number of interior rings
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

num-patches back to 'Function Summary'
declare function geo:num-patches (
            $polyhedral-surface as element(gml:Surface) 
 ) as xs:integer external

Return the number of surface patches inside a gml:Surface.
This function has the same effect as num-geometries(), only it is restricted to gml:Surface.

Parameters:
  • $polyhedral-surface node of one of GMLSF objects: gml:Surface
Returns:
  • the number of surface patches
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

num-points back to 'Function Summary'
declare function geo:num-points (
            $line as element(*) 
 ) as xs:unsignedInt external

Return the number of Points in a line.

Parameters:
  • $line node of one of GMLSF objects: gml:LineString, gml:LinearRing, gml:Curve, gml:MultiCurve
Returns:
  • number of points in the line
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

overlaps back to 'Function Summary'
declare function geo:overlaps (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if geometry1 overlaps with geometry2.
Returns true if DE-9IM intersection matrix for the two geometries is T*T***T** (for two points or two surfaces) or * 1*T***T** (for two curves).

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if geometry1 overlaps geometry2.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

patch-n back to 'Function Summary'
declare function geo:patch-n (
            $polyhedral-surface as element(gml:Surface), 
            $n as xs:unsignedInt 
 ) as element(gml:PolygonPatch) external

Return the n-th Surface patch of a Surface.
Only polygonal Surfaces are supported, so a gml:PolygonPatch is returned.
The gml:PolygonPatch has the same content as gml:Polygon.
This function has the same effect as geometry-n(), only it is restricted to gml:Surface.

Parameters:
  • $polyhedral-surface node of one of GMLSF objects: gml:Surface
  • $n index in the list of surface patches, zero based.
Returns:
  • n-th polygon patch. The node is the original node, not a copy.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:IndexOutsideRange
  • geo-err:GEOSError
Examples:

point-n back to 'Function Summary'
declare function geo:point-n (
            $line as element(*), 
            $n as xs:unsignedInt 
 ) as element(gml:Point) external

Return the n-th Point in a line.

Parameters:
  • $line node of one of GMLSF objects: gml:LineString, gml:LinearRing, gml:Curve, gml:MultiCurve
  • $n index in the list of coordinates, zero based.
Returns:
  • n-th point in the line, zero-based. The node is gml:Point constructed with n-th coordinate from line.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

point-on-surface back to 'Function Summary'
declare function geo:point-on-surface (
            $geometry as element(*) 
 ) as element(gml:Point) external

Returns a Point that is interior of this geometry. If it cannot be inside the geometry, then it will be on the boundary.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • a Point inside the geometry.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

relate back to 'Function Summary'
declare function geo:relate (
            $geometry1 as element(*), 
            $geometry2 as element(*), 
            $intersection_matrix as xs:string 
 ) as xs:boolean external

Checks if geometry1 relates with geometry2 relative to a DE-9IM matrix.
The DE-9IM matrix is defined like this:

Interior Boundary Exterior
Interior dim(intersection of interior1 and interior2) dim(intersection of interior1 and boundary2) dim(intersection of interior1 and exterior2)
Boundary dim(intersection of boundary1 and interior2) dim(intersection of boundary1 and boundary2) dim(intersection of boundary1 and exterior2)
Exterior dim(intersection of exterior1 and interior2) dim(intersection of exterior1 and boundary2) dim(intersection of exterior1 and exterior2)

The values in the DE-9IM can be T, F, *, 0, 1, 2 .
- T means the intersection gives a non-empty result.
- F means the intersection gives an empty result.
- * means any result.
- 0, 1, 2 gives the expected dimension of the result (point, curve, surface)


For example, the matrix of "T*T***T**" checks for intersections of interior1 with interior2, interior1 with exterior2 and exterior1 with interior2.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:LinearRing, gml:Polygon
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:LinearRing, gml:Polygon
  • $intersection_matrix the DE-9IM matrix, with nine chars, three chars for each line in DE-9IM matrix.
Returns:
  • true if geometry1 relates to geometry2 according to the intersection matrix.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

srid back to 'Function Summary'
declare function geo:srid (
            $geometry as element(*) 
 ) as xs:anyURI? external

Return the srid URI of geo object. SRID is contained in the srsName attribute in the geo element, or one of the parents, or in the boundedBy/Envelope element in one of the parents.
This function searches recursively from this element up to the top-most parent.

Parameters:
  • $geometry node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • the SRID if it is found
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

start-point back to 'Function Summary'
declare function geo:start-point (
            $line as element(*) 
 ) as element(gml:Point) external

Returns the start Point of a line.

Parameters:
  • $line node of one of GMLSF objects: gml:LineString, gml:LinearRing, gml:Curve
Returns:
  • the starting gml:Point, constructed with the first coordinates in the line.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

sym-difference back to 'Function Summary'
declare function geo:sym-difference (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as element(*)? external

Returns a geometric object that represents the Point set symmetric difference of geometry1 and geometry2. Points that are in geometry1 and are not in geometry2 and points that are in geometry2 and are not in geometry1.
If difference is empty geometry, empty sequence is returned.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • point set geometry node.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

touches back to 'Function Summary'
declare function geo:touches (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if geometry1 touches geometry2.
Returns true if the DE-9IM intersection matrix for the two geometries is FT*******, F**T***** or F***T****.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if geometry1 touches geometry2.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

union back to 'Function Summary'
declare function geo:union (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as element(*) external

Returns a geometric object that represents the Point set union of geometry1 and geometry2.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • point set geometry node.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

within back to 'Function Summary'
declare function geo:within (
            $geometry1 as element(*), 
            $geometry2 as element(*) 
 ) as xs:boolean external

Checks if geometry1 is within geometry2.
Returns true if the DE-9IM intersection matrix for the two geometries is T*F**F***.

Parameters:
  • $geometry1 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
  • $geometry2 node of one of GMLSF objects: gml:Point, gml:LineString, gml:Curve, gml:LinearRing, gml:Surface, gml:Polygon, gml:MultiPoint, gml:MultiCurve, gml:MultiSurface, gml:MultiGeometry
Returns:
  • true if geometry1 is within geometry2.
Errors:
  • geo-err:UnrecognizedGeoObject
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:SRSNotIdenticalInBothGeometries
  • geo-err:GEOSError
Examples:

declare function geo:x (
            $point as element(gml:Point) 
 ) as xs:double external

Returns the X coordinate of a Point.

Parameters:
  • $point node of one of GMLSF objects: gml:Point
Returns:
  • the X coordinate
Errors:
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

declare function geo:y (
            $point as element(gml:Point) 
 ) as xs:double external

Returns the Y coordinate of a Point.

Parameters:
  • $point node of one of GMLSF objects: gml:Point
Returns:
  • the Y coordinate
Errors:
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

declare function geo:z (
            $point as element(gml:Point) 
 ) as xs:double? external

Returns the Z coordinate of a Point, if is 3D.

Parameters:
  • $point node of one of GMLSF objects: gml:Point
Returns:
  • the Z coordinate, or empty sequence if 2D
Errors:
  • geo-err:UnsupportedSRSDimensionValue
  • geo-err:GEOSError
Examples:

blog comments powered by Disqus