geo.boxPolygon( box as cts.box, [options as String[]] ) as cts.region
Construct a polygon from a box.
It is recommended to use this function for queries, as box geometry matching cannot be optimized. Convert boxes to polygons before passing them in as arguments to your queries to get better performance.
'use strict'; geo.toWkt(geo.boxPolygon(cts.box(20.719136043990826,-156.8027533606166,20.934773647078917,-157.06917181764786),'coordinate-system=wgs84/double')) // => // POLYGON((-156.802753360617 20.7191360439908,-156.802753360617 20.9347736470789,-157.069171817648 20.9347736470789,-157.069171817648 20.7191360439908,-156.802753360617 20.7191360439908))
// Optic example using the Value Processing Function op.geo.intersects with geo.boxPolygon() // boxPolygonLit is a polygon representing a rough box around Tucson, Arizona, US const op = require('/MarkLogic/optic'); var boxPolygonLit = geo.boxPolygon(cts.box(31.95998068725855,-110.74619309278187,32.42948158439288,-111.22959153028187)) const result=op.fromView('buildings', 'builds') .where(op.geo.intersects(op.col('poly'),boxPolygonLit)) .select([op.col('name'), op.col('geoid')]) .orderBy('geoid') .result() result; // ==> // rows representing names and geoids of values in the 'poly' column that INTERSECT boxPolygonLit