cts:element-attribute-pair-geospatial-boxes( $parent-element-names as xs:QName*, $latitude-names as xs:QName*, $longitude-names as xs:QName*, [$latitude-bounds as xs:double*], [$longitude-bounds as xs:double*], [$options as xs:string*], [$query as cts:query?], [$quality-weight as xs:double?], [$forest-ids as xs:unsignedLong*] ) as cts:box*
Returns boxes derived from the specified element point lexicon(s). Element point lexicons are implemented using geospatial indexes; consequently this function requires a geospatial element attribute pair index for each parent element and attribute pair specified in the function. If there is not a geospatial index configured for each of the specified combinations, an exception is thrown.
The points are divided into box-shaped buckets. The $latitude-bounds and $longitude-bounds parameters specify the number and the size of each box-shaped bucket. All included points are bucketed, even those outside the bounds. An empty sequence for both $latitude-bounds and $longitude-bounds specifies one bucket, a single value for both specifies four buckets, two values for both specify nine buckets, and so on.
For each non-empty bucket, a
cts:box
value is returned. By default, the
cts:box
value is the minimum bounding box of all the points in the bucket. If
the "gridded" option is specified, then if a bucket is bounded on a side,
its corresponding
cts:box
side is the bound. Empty buckets return nothing unless the "empties" option
is specified.
Parameters | |
---|---|
parent-element-names | One or more element QNames. |
latitude-names | One or more element QNames. |
longitude-names | One or more element QNames. |
latitude-bounds | A sequence of latitude bounds. The values must be in strictly ascending order, otherwise an exception is thrown. |
longitude-bounds | A sequence of longitude bounds. The values must be in strictly ascending order, otherwise an exception is thrown. |
options |
Options. The default is ().
Options include:
|
query |
Only include points in fragments selected by this query,
and compute frequencies from this set of included points.
The points do not need to match the query, but they must occur in
fragments selected by the query.
The fragments are not filtered to ensure they match the query,
but instead selected in the same manner as
"unfiltered" cts:search operations.
|
quality-weight | A document quality weight to use when computing scores. The default is 1.0. |
forest-ids | A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is (). |
Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".
Only one of "fragment-frequency" or "item-frequency" may be specified in the options parameter. If neither "fragment-frequency" nor "item-frequency" is specified, then the default is "fragment-frequency".
Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.
Only one of "eager" or "lazy" may be specified in the options parameter. If neither "eager" nor "lazy" is specified, then the default is "eager" if "frequency-order" or "empties" is specified, otherwise "lazy".
Only one of "any", "document", "properties", or "locks" may be specified in the options parameter. If none of "any", "document", "properties", or "locks" are specified and there is a $query parameter, then the default is "document". If there is no $query parameter then the default is "any".
Only one of the "score-logtfidf", "score-logtf", "score-simple", "score-random", or "score-zero" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", "score-simple", "score-random", or "score-zero" are specified, then the default is "score-logtfidf".
Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".
If "coordinate-system=name" is not specified in the options parameter, then the default coordinate system is used. If a lexicon with that coordinate system does not exist, an error is thrown.
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 query uses single precision.
If "sample=N" is not specfied in the options parameter,
then all boxes with included points may be returned. If a $query
parameter is not present, then "sample=N" has no effect.
If "truncate=N" is not specfied in the options parameter,
then points from all fragments selected by the $query
parameter
are included. If a $query
parameter is not present, then
"truncate=N" has no effect.
To incrementally fetch a subset of the values returned by this function,
use fn:subsequence
on the output, rather than
the "skip" option. The "skip" option is based on fragments matching the
query
parameter (if present), not on values. A fragment
matched by the query might produce multiple boxes or no boxes.
The number of fragments skipped does not correspond to the number of
boxes. Also, the skip is applied to the relevance ordered query matches,
not to the ordered box list.
When using the "skip" option, use the "truncate" option rather than the "limit" option to control the number of matching fragments from which to draw values.
(: Create a 15 degree latitude by 30 degree longitude grid over the Eastern part of the Northern hemisphere, figure out how many points are in each grid section, and return a box for each grid section, whether it has points in it or not. The box will have the actual min/max latitudes and longitudes of points in that grid section as its bounds. Order the boxes in increasing order of latitude and longitude, and return the frequency of points in the box and the box itself. The points will be those in the element "point" where the latitude value is in the attribute "lat" and the longitude value is in the attribute "long". :) for $box in cts:element-attribute-pair-geospatial-boxes( xs:QName("point"), xs:QName("lat"), xs:QName("long"), (15, 30, 45, 60, 75), (0, 30, 60, 90, 120), ("ascending", "empties")) return (cts:frequency($box), $box)
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.