FUNCTION  fHTM_Cover

Returns a table of (HtmIdStart, HtmIdEnd) that covers the area.

This is the main access function to the HTM spatial index.

The result is a record set with the schema
(HtmIdStart bigint, HtmIdEnd bigint)
The area is specified as a CIRCLE, CONVEX, or DOMAIN.
Each of these can use J2000 (ra,dec), or cartesian (xyz) coordinates.
The area parameter begins with a
[CIRCLE | CONVEX] [J2000 | CARTESIAN]
header, then it has the following params:

  • Depth is an int between 0...24, it specifies how fine a triangular mesh is desired.
  • ra is right ascencion is float64 units are degrees
  • dec is right declination is float64 units are degrees
  • rad is circle radius in arcminutes float64
  • x,y,z are coordinates in cartesian space, float64
  • d is a distance along the x, y, z vector when defining a cone (d in -1...+1).


    The following examples request a 6-deep htm list covering a
    a circular region, convex hull or a domain

    CIRCLE J2000 6 41.4 47.9 20
    CIRCLE CARTESIAN 6 1.0 0.0 0.0 10.0
    CONVEX J2000 6 41.4 47.9 41.2 47.9 41.0 47.5 41.4 48
    CONVEX CARTESIAN depth x1 y1 z1 x2 y2 z2 ... xn yn zn
    CONVEX CARTESIAN 6 1 1 1 0 1 1 1 0
    DOMAIN 1 n x1 y1 z1 d1 x2 y2 z2 d2... xn yn zn dn

    (See also fHTM_Cover_ErrorMessage)
  • NameTypeLengthinoutpnum
    @AreaVARCHAR8000input1
    HTMIDstartBIGINT8output1
    HTMIDendBIGINT8output2