Loading TOC...

MarkLogic 12 EA 1 Product Documentation
geo:disjoint

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

Summary

Compares geospatial regions to see if they fulfill the 'disjoint' DE-9IM relation.

Parameters
region-1 The first geospatial region to compare. This region is the left operand of disjoint.
region-2 The second geospatial region to compare. This region is the right operand of disjoint.
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 determines whether the two regions R1=$region-1 and R2=$region-2 satisfy the relationship R1 disjoint R2.

The operations are defined by the Dimensionally Extended nine-Intersection Model (DE-9IM) of spatial relations.

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. The DISJOINT operation is expensive, especially when run against many rows or values.

See Also

Example

let $r1 := cts:polygon("POLYGON((-122.38582892471908 37.61827880006116,-122.4143247132933 37.60685626556358,-122.40436835343002 37.59352775797751,-122.38582892471908 37.61827880006116))")
let $r2 := cts:point("POINT(-122.16318411881082 37.736751905735126)")
return geo:disjoint($r1,$r2,("coordinate-system=wgs84","precision=double"))

(: returns true :)
  

Example

xquery version "1.0-ml";
import module namespace op = 'http://marklogic.com/optic' 
           at 'MarkLogic/optic.xqy';
import module namespace ogeo = 'http://marklogic.com/optic/expression/geo' 
           at 'MarkLogic/optic/optic-geo.xqy';

(: Optic example using the Value Processing Function ogeo:disjoint() :)
let $polygonLit := 'POLYGON((-109.05489567149378 37.007687849517886,-109.05489567149378 31.321594772151634,-108.19796207774378 31.39664652828848,-108.26388004649378 31.827028203476246,-106.52804020274378 31.808357379968474,-106.55001285899378 32.08802274501026,-103.03438785899378 32.03215780670212,-103.01241520274378 37.025232193318125,-109.05489567149378 37.007687849517886))'
let $plan:= op:from-view('buildings', 'builds')
             =>op:where(ogeo:disjoint(op:col('poly'),$polygonLit))
             =>op:select(('name', op:col('geoid')))
             =>op:order-by('geoid')

return $plan=>op:result()

(:
==>
rows of names and geoids where the 'poly' column is DISJOINT from polygonLit (a rough New Mexico representation)
:)
  

Example

xquery version "1.0-ml";
(: SQL example using the ST_Disjoint function :)
let $map :=
    map:new(map:entry('polyLit','POLYGON((-83.74086287706339 35.30705888366864,-82.57081893175089 35.30705888366864,-82.57081893175089 33.64983884507408,-83.74086287706339 33.64983884507408,-83.74086287706339 35.30705888366864))'))

return xdmp:sql("select * from builds where ST_Disjoint(poly,@polyLit) order by geoid limit 20", (), $map)
(:
==>
returns rows whose 'poly' column match the DE-9IM relationship DISJOINT from the provided WKT polygon
:)
  

Example

xquery version "1.0-ml";
(: GeoSPARQL example using geof:sfDisjoint() :)
let $map :=
    map:new(map:entry('poly','POLYGON((-83.74086287706339 35.30705888366864,-82.57081893175089 35.30705888366864,-82.57081893175089 33.64983884507408,-83.74086287706339 33.64983884507408,-83.74086287706339 35.30705888366864))'))

let $query:=
'
PREFIX my: <http://example.org/ApplicationSchema#>
PREFIX geoml: <http://marklogic.com/geospatial#>
PREFIX cts: <http://marklogic.com/cts#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
 
SELECT *
WHERE { ?s my:hasExactGeometry ?o
  FILTER geof:sfDisjoint(?o, ?poly, ''coordinate-system=wgs84'')
}
ORDER BY ?s'

return sem:sparql($query,$map)

(:
==>
rows representing geometries in a triple's object in the wgs84 coordinate system
that fulfill the DISJOINT DE-9IM relation with the WKT polygon 'poly', ordered by subject
:)
  

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