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: 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) |
Name | Type | Length | inout | pnum |
@Area | VARCHAR | 8000 | input | 1 |
HTMIDstart | BIGINT | 8 | output | 1 |
HTMIDend | BIGINT | 8 | output | 2 |
Returns 20-deep HTMid of a given Equatorial point (@ra,@dec). |
Sample call to get the HTMid of ra,dec 185,0
SELECT dbo.fGetNearbyObjEq(185,0) |
Name | Type | Length | inout | pnum |
@ra | float | 8 | input | 1 |
@dec | float | 8 | input | 2 | bigint | 8 | output | 1 |
Returns table of objects from @table within @r arcmins of an Equatorial point (@ra,@dec). |
There is no limit on the number of objects returned, but there are about 40 per sq arcmin.
returned table:
Sample call to find all the Galaxies within 5 arcminutes of ra,dec 185,0 SELECT * FROM Galaxy AS G, dbo.fGetNearbyObjEq(185,0,5,1) AS N WHERE G.objID = N.objID (see also fGetNearestObjEq, fGetNearbyObjXYZ, fGetNearestObjXYZ) |
Name | Type | Length | inout | pnum |
@ra | float | 8 | input | 1 |
@dec | float | 8 | input | 2 |
@r | float | 8 | input | 3 |
@table | tinyint | 1 | input | 4 |
objID | bigint | 8 | output | 1 |
cx | float | 8 | output | 2 |
cy | float | 8 | output | 3 |
cz | float | 8 | output | 4 |
htmID | bigint | 8 | output | 5 |
distance | float | 8 | output | 6 |
Returns table holding a record describing the closest object within @r arcminutes of (@ra,@dec). |
returned table:
Sample call to find the table 1 object within 2 arcminutes of ra,dec 185 SELECT N.* FROM dbo.fGetNearestObjEq(185,0,2,1) (see also fGetNearbyObjEq, fGetNearbyObjXYZ, fGetNearestObjXYZ) |
Name | Type | Length | inout | pnum |
@ra | float | 8 | input | 1 |
@dec | float | 8 | input | 2 |
@r | float | 8 | input | 3 |
@table | tinyint | 1 | input | 4 |
objID | bigint | 8 | output | 1 |
cx | float | 8 | output | 2 |
cy | float | 8 | output | 3 |
cz | float | 8 | output | 4 |
htmID | bigint | 8 | output | 5 |
distance | float | 8 | output | 6 |
Returns the objId of nearest @table object within @r arcmins. |
This scalar function is used for matchups of external catalogs.
It calls the fGetNearestObjEq(@ra,@dec,@r), and selects the objId (a bigint). This can be called by a single SELECT from an uploaded (ra,dec) table. An example: SELECT id, ra,dec, dbo.fGetNearestObjIdEq(ra,dec,3.0,1) AS objId FROM #upload WHERE dbo.fGetNearestObjIdEq(ra,dec,3.0,1) IS NOT NULL
|
Name | Type | Length | inout | pnum |
@ra | float | 8 | input | 1 |
@dec | float | 8 | input | 2 |
@r | float | 8 | input | 3 |
@table | tinyint | 1 | input | 4 | bigint | 8 | output | 1 |
Returns float holding great circle distance between two points (ra1,dec1) & (ra2,dec2) |
The great circle distance is in arcmins, the ras and decs are in degrees.
|
Name | Type | Length | inout | pnum |
@ra1 | float | 8 | input | 1 |
@dec1 | float | 8 | input | 2 |
@ra2 | float | 8 | input | 3 |
@dec2 | float | 8 | input | 4 | float | 8 | output | 1 |