Loading TOC...

MarkLogic Server 11.0 Product Documentation
geo:region-de9im

geo:region-de9im(
   $region-1 as cts:region,
   $region-2 as cts:region,
   [$options as xs:string*]
) as xs:string

Summary

Calculates the Dimensionally Extended nine-Intersection Matrix (DE-9IM) of two geospatial regions.

Parameters
region-1 The first geospatial region to compare.
region-2 The second geospatial region to compare.
options Options to this operation. The default is (). Available options:
"coordinate-system=string"
Use the given coordinate system. Valid values are:
wgs84
The WGS84 coordinate system with degrees as the angular unit.
wgs84/radians
The WGS84 coordinate system with radians as the angular unit.
wgs84/double
The WGS84 coordinate system at double precision with degrees as the angular unit.
wgs84/radians/double
The WGS84 coordinate system at double precision with radians as the angular unit.
etrs89
The ETRS89 coordinate system.
etrs89/double
The ETRS89 coordinate system at double precision.
raw
The raw (unmapped) coordinate system.
raw/double
The raw coordinate system at double precision.
"precision=value"
Use the coordinate system at the given precision. Allowed values: float and double.
"units=value"
Measure distance, radii of circles, and tolerance in the specified units. Allowed values: miles (default), km, feet, meters.
"tolerance=distance"
Tolerance is the largest allowable variation in geometry calculations. If the distance between two points is less than tolerance, then the two points are considered equal. For the raw coordinate system, use the units of the coordinates. For geographic coordinate systems, use the units specified by the units option.

Usage Notes

This function calculates the Dimensionally Extended nine-Intersection Matrix (DE-9IM) of the two input regions, and returns the result as a string. In this model, a region divides the coordinate space into 3 sets of points: interior (I), boundary (B), and exterior (E). Each of these 3 sets from the first region is intersected with each of the 3 sets from the second region, and the dimensions of the intersections are calculated. This results in 9 dimensions, which are the entries of the matrix. These dimensions are also denoted using terms II, IB, IE, BI, etc. For instance, "IB" is the dimension of the intersection of the interior (I) of $region-1 with the boundary (B) of $region-2.

The output of this function is a string of nine characters, which correspond to the 9 entries in the intersection matrix (in order): II, IB, IE, BI, BB, BE, EI, EB, EE. Each character will either be an integer "0", "1", or "2", representing the dimension of the intersection, or "F", indicating no intersection.

DE9-IM also defines spatial predicates based on the intersection matrix, including "intersects", "overlaps", and "contains". To test whether two regions satisfy one of these predicates, use geo:region-relate.

The value of the precision option takes precedence over that implied by the governing coordinate system name, including the value of the coordinate-system option. For example, if the governing coordinate system is "wgs84/double" and the precision option is "float", then the operation uses single precision.

Example

let $r1 := cts:polygon("POLYGON((-122.427520751953 37.6555576956251,-122.459106445313 37.5658069549294,-122.289505004883 37.5946477878735,-122.427520751953 37.6555576956251))")
let $r2 := cts:linestring("LINESTRING(-122.571029663086 37.5728821555562,-122.400054931641 37.6077041124284,-122.161102294922 37.5696167618573)")
return geo:region-de9im($r1,$r2,("coordinate-system=wgs84","precision=double"))

(: returns "1F20F1102", which reflects a "crosses" relationship :)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.