VO Course 11: Spatial indexing

74
Spatial Indexing Juan de Dios Santander Vela (IAA-CSIC)

description

Introduction to the problem of spatial indexing for spherical coordinate systems, as those used in astronomy. Part of the virtual observatory course by Juan de Dios Santander Vela, as imparted for the MTAF (Métodos y Técnicas Avanzadas en Física, Advanced Methods and Techniques in Physics) Master at the University of Granada (UGR).

Transcript of VO Course 11: Spatial indexing

Page 1: VO Course 11: Spatial indexing

Spatial IndexingJuan de Dios Santander Vela (IAA-CSIC)

Page 2: VO Course 11: Spatial indexing

Spherical coordinates

Wrap Around

Singularities at the Poles

Changing Width

Why Spatial Indexing?

Page 3: VO Course 11: Spatial indexing

Spherical coordinates

Wrap Around

Singularities at the Poles

Changing Width

Why Spatial Indexing?

Page 4: VO Course 11: Spatial indexing

Spherical coordinates

Wrap Around

Singularities at the Poles

Changing Width

Why Spatial Indexing?

Page 5: VO Course 11: Spatial indexing

Query on Arbitrary Shapes

Object Contours

Instrument Footprints

Region Intersections

Region operations integral to ADQL!

Why Spatial Indexing?

Page 6: VO Course 11: Spatial indexing

Using partitioning schemesQuery applications

Spatial joins

X-Match applications

Display applications

Core spatial region support

Page 7: VO Course 11: Spatial indexing

Spherical Coordinatesx = r sin q cos f

y = r sin q sin f

z = r cos q

x = sin q cos f

y = sin q sin f

z = cos q

Page 8: VO Course 11: Spatial indexing

Typical Query Case: Cone Search

SELECT * FROM TARGET_TABLE WHERE 2 * ASIN( SQRT(SIN(($DEC_C-DEC)/2) * SIN(($DEC_C-DEC)/2) + COS($DEC_C) * COS(DEC) * SIN(($RA_C - RA)/2) * SIN(($RA_C - RA)/2))) <= $SR_C

SELECT * FROM RASS_PHOTONS WHERE X*$X_C+Y*$Y_C+Z*$Z_C >= COS($SR_C)

Page 9: VO Course 11: Spatial indexing

Spatial Indexing Elements

Half-Space

A.K.A

CONSTRAINT

Page 10: VO Course 11: Spatial indexing

Spatial Indexing Elements

Convex

A POLYGON IS A UNION OF CONVEXES

Page 11: VO Course 11: Spatial indexing

Spatial Indexing Elements

HTM Indexing & Trixels

LEVEL 0 LEVEL 1 LEVEL 2

Page 12: VO Course 11: Spatial indexing

Spatial Indexing Elements

HTM Indexing & Trixels

Page 13: VO Course 11: Spatial indexing

Indexing SchemesUnordered infinite plane versus ordered finite plane

Different coordinate systems needed for different things

Cartesian

Spherical

Plus, discontinuities in both!

Page 14: VO Course 11: Spatial indexing

Indexing Schemes

Easy query/look-up of plane or spherical coordinate-based objects

Hierarchical (suitable for wavelet, storage locality…)

Adaptability to transformations (spherical harmonics, wavelet, FFT…)

Page 15: VO Course 11: Spatial indexing

Indexing Schemes

Partitioning

HEALPix

HTM

Q3C

Mostly quad-tree-like schemes

Page 16: VO Course 11: Spatial indexing

HEALPix

Page 17: VO Course 11: Spatial indexing

HEALPix

By Górsky, Hivon, Banday, et al. (first ESO, later JPL)

Main concerns:

Hierarchical structure

Equal area partitioning

Isolatitude distribution

Page 18: VO Course 11: Spatial indexing

HEALPix

By Górsky, Hivon, Banday, et al. (first ESO, later JPL)

Main concerns:

Hierarchical structure

Equal area partitioning

Isolatitude distribution

HEALPix: A FRAMEWORK FOR HIGH-RESOLUTION DISCRETIZATION AND FAST ANALYSISOF DATA DISTRIBUTED ON THE SPHERE

K. M. Gorski,1,2 E. Hivon,3 A. J. Banday,4 B. D. Wandelt,5,6 F. K. Hansen,7

M. Reinecke,4 and M. Bartelmann8

Received 2004 September 21; accepted 2004 December 10

ABSTRACT

HEALPix—the Hierarchical Equal Area isoLatitude Pixelization—is a versatile structure for the pixelization ofdata on the sphere. An associated library of computational algorithms and visualization software supports fastscientific applications executable directly on discretized spherical maps generated from very large volumes ofastronomical data. Originally developed to address the data processing and analysis needs of the present generationof cosmic microwave background experiments (e.g., BOOMERANG,WMAP), HEALPix can be expanded to meetmany of the profound challenges that will arise in confrontation with the observational output of future missions andexperiments, including, e.g., Planck, Herschel, SAFIR, and the Beyond Einstein inflation probe. In this paper weconsider the requirements and implementation constraints on a framework that simultaneously enables an efficientdiscretization with associated hierarchical indexation and fast analysis/synthesis of functions defined on the sphere.We demonstrate how these are explicitly satisfied by HEALPix.

Subject headinggs: cosmic microwave background — cosmology: observations — methods: statistical

1. INTRODUCTION

Advanced detectors in modern astronomy generate data athuge rates over many wavelengths. Of particular interest to usare those data sets that accumulate measurements distributed onthe entire sky, or a considerable fraction thereof. Typical exam-ples include radio, cosmic microwave background (CMB), sub-millimeter, infrared, X-ray, and gamma-ray sky maps of diffuseemission, and full-sky or wide-area surveys of extragalactic ob-jects. Together with this wealth of gathered information comesan inevitable increase in complexity for data reduction and sci-ence extraction. In this paper we are focused on those issuesrelated to the distinctive nature of the spherical spatial domainover which the data reside. Our original motivations arose fromwork related to the measurement and interpretation of the CMBanisotropy. The growing complexity of the associated scienceextraction problem can be illustrated by the transition betweenthe data sets from various experiments: COBE Differential Mi-crowave Radiometer (DMR) (early1990s, 7! FWHM resolution,"6000 pixel sky maps at three wavelengths), BOOMERANG(late 1990s, 120 FWHM, partial sky maps of "200,000 pixelsat four wavelengths), WMAP (early 2000s, resolution up to 140

FWHM, "3 million pixel sky maps at five wavelengths), andPlanck (data expected ca. 2009, resolution up to 50 FWHM,"50 million pixel sky maps at nine wavelengths). Science ex-traction from these data sets involves the following:

1. global analysis problems: harmonic decomposition, esti-mation of the power spectrum, and higher order measures ofspatial correlations;

2. real space morphological analyses, object detection, iden-tification, and characterization;

3. the simulation of models of the primary and foregroundsky signals to study instrument performance and calibrate fore-ground separation and statistical inference methods; and

4. spatial and/or spectral cross-correlation with external datasets.

These tasks, and many others, necessitate a careful definition ofthe data models and proper construction of the mathematicalframework for data analysis such that the algorithmic and com-puting time requirements can be satisfied in order to achieve thesuccessful and timely scientific interpretation of the observa-tions. A particular method of addressing some of these issues isdescribed next.

2. DISCRETIZED MAPPING AND ANALYSISOF FUNCTIONS ON THE SPHERE

The analysis of functions on domains with a spherical to-pology occupies a central place in both the physical sciencesand engineering disciplines. This is particularly apparent in thefields of astronomy, cosmology, geophysics, and atomic and nu-clear physics. In many cases the geometry is dictated either bythe object under study or by the need to assume and exploit ap-proximate spherical symmetry to utilize powerful perturbativetechniques. Practical limits for the purely analytical study ofthese problems create an urgent necessity for efficient and ac-curate numerical tools.

The simplicity of the spherical form belies the intricacy ofglobal analysis on the sphere. There is no known point set thatachieves the analog of uniform sampling in Euclidean spaceand allows exact and invertible discrete spherical harmonic de-compositions of arbitrary but band-limited functions. All ex-isting practical schemes proposed for the treatment of suchdiscretized functions on the sphere introduce some (hopefully

1 JPL /Caltech, MS 169-327, 4800 Oak Grove Drive, Pasadena, CA 91109.2 Warsaw University Observatory, Aleje Ujazdowskie 4, 00-478 Warsaw,

Poland.3 IPAC, MS 100-22, Caltech, 1200 East California Boulevard, Pasadena,

CA 91125.4 Max-Planck-Institut f ur Astrophysik, Karl-Schwarzschild-Strasse 1,

Postfach 1317, D-85741 Garching bei Munchen, Germany.5 Department of Physics, University of Illinois, Urbana, IL 61801.6 Department of Astronomy, University of Illinois, 1002 West Green

Street, Urbana, IL 61801.7 Institute of Theoretical Astrophysics, University of Oslo, P.O. Box 1029

Blindern, N-0315 Oslo, Norway.8 ITA, Universitat Heidelberg, Tiergartenstrasse 15, D-69121 Heidelberg,

Germany.

759

The Astrophysical Journal, 622:759–771, 2005 April 1# 2005. The American Astronomical Society. All rights reserved. Printed in U.S.A.

Page 19: VO Course 11: Spatial indexing

HEALPix

Fig. 2.—Several possible equal-area isolatitude tessellations of the sphere, which can support a hierarchical tree for the further subdivision of each large base-resolution pixel. Six variants of such a tessellation are shown here for several values of the grid parameters N! and N". ! refers to the colatitude and " to the longitude.For each panel two projections are shown: the top one is orthographic, the bottom one is cylindrical. !* defines the line of constant colatitude that separates the equatorialregion from the northern polar region. This is shown by the top curve in the orthographic plot; also shown is the corresponding curve separating the equatorial andsouthern polar regions, as well as the equator. The HEALPix implementation is described by N! ! 3 and N" ! 4.

Page 20: VO Course 11: Spatial indexing

HEALPix

Fig. 2.—Several possible equal-area isolatitude tessellations of the sphere, which can support a hierarchical tree for the further subdivision of each large base-resolution pixel. Six variants of such a tessellation are shown here for several values of the grid parameters N! and N". ! refers to the colatitude and " to the longitude.For each panel two projections are shown: the top one is orthographic, the bottom one is cylindrical. !* defines the line of constant colatitude that separates the equatorialregion from the northern polar region. This is shown by the top curve in the orthographic plot; also shown is the corresponding curve separating the equatorial andsouthern polar regions, as well as the equator. The HEALPix implementation is described by N! ! 3 and N" ! 4.

Astronomy & Astrophysics manuscript no. mhg June 20, 2005(DOI: will be inserted by hand later)

Mapping on the HEALPix grid

M. R. Calabretta1 and B. F. Roukema2

1 Australia Telescope National Facility, PO Box 76, Epping, NSW 1710, Australia2 Torun Centre for Astronomy, N. Copernicus University, ul. Gagarina 11, PL-87-100 Torun, Poland

Draft dated 2005/06/15

Abstract. The natural spherical projection associated with the Hierarchical Equal Area and isoLatitude Pixelisation, HEALPix,is described and shown to be one of a hybrid class that combines the cylindrical equal-area and Collignon projections, notpreviously documented in the cartographic literature. Projection equations are derived for the class in general and it is shownthat the HEALPix projection suggests a simple method (a) of storing, and (b) visualising data sampled on the grid of theHEALPix pixelisation, and also suggests an extension of the pixelisation that is better suited for these purposes. Potentiallyuseful properties of other members of the class are described, and new triangular and hexagonal pixelisations are constructedfrom them. Finally, the formalism is defined for representing the celestial coordinate system for any member of the class in theFITS data format.

Key words. astronomical data bases: miscellaneous – cosmic microwave background – cosmology: observations – methods:data analysis, statistical – techniques: image processing

1. Introduction

The Hierarchical Equal Area and isoLatitude Pixelisation,HEALPix (Gorski et al. 2004), o↵ers a scheme for distributing12N2(N 2 ) points as uniformly as possible over the surfaceof the unit sphere subject to the constraint that the points lie ona relatively small number (4N � 1) of parallels of latitude andare equispaced in longitude on each of these parallels. Theseproperties were chosen to optimise spherical harmonic analy-sis and other computations performed on the sphere.

In fact, HEALPix goes further than simply defining a dis-tribution of points; it also specifies the boundary between ad-jacent points and does so in such a way that each occupies thesame area. Thus HEALPix is described as an equal area pix-elisation. Pixels at the same absolute value of the latitude havethe same shape in the equatorial region, though pixel shape dif-fers between latitudes, and with longitude in the polar regions.The boundaries for N = 1 define the 12 base-resolution pix-els and higher-order pixelisations are defined by their regularsubdivision. Note, however, that although they are four-sided,HEALPix pixels are not spherical quadrilaterals because theiredges are not great circle arcs.

HEALPix was originally described purely with referenceto the sphere, the data itself being stored as a one-dimensionalarray in a FITS binary table (Cotton et al. 1995) with eitherring or nested organisation, the former being suited for spher-ical harmonic analysis and the latter for nearest-neighboursearches. For visualisation purposes the software that imple-

Send o↵print requests to: M. Calabretta,e-mail: [email protected]

0

-9090-1200120

-180-90090180-60-45

4560

-135-4545135

-75-60

-30-15

0

1530

6075

90

Fig. 1. The HEALPix class of projections for H = 1, 2, 3 rescaled tounit area (top), and the nominative case with H = 4 (bottom) at twicethe linear scale and with the top left-hand corner of the graticule “cutaway” to reveal the underlying cylindrical equal-area projection in theequatorial region. Facets are shown as dashed diamonds.

ments HEALPix o↵ers a choice of four conventional projectiontypes onto which HEALPix data may be regridded.

Page 21: VO Course 11: Spatial indexing

HEALPix

Fig. 2.—Several possible equal-area isolatitude tessellations of the sphere, which can support a hierarchical tree for the further subdivision of each large base-resolution pixel. Six variants of such a tessellation are shown here for several values of the grid parameters N! and N". ! refers to the colatitude and " to the longitude.For each panel two projections are shown: the top one is orthographic, the bottom one is cylindrical. !* defines the line of constant colatitude that separates the equatorialregion from the northern polar region. This is shown by the top curve in the orthographic plot; also shown is the corresponding curve separating the equatorial andsouthern polar regions, as well as the equator. The HEALPix implementation is described by N! ! 3 and N" ! 4.

Page 22: VO Course 11: Spatial indexing

HEALPix

should be retained for reasons related to the fast harmonictransform.

This preferred implementation, which is referred to asHEALPix, is a geometrically constructed, self-similar, refinablequadrilateral mesh on the sphere as shown in Figure 3. The baseresolution comprises 12 pixels in three rings around the polesand equator. The resolution of the grid is expressed by the pa-rameter Nside, which defines the number of divisions along theside of a base-resolution pixel that is needed to reach a desiredhigh-resolution partition.11 All pixel centers are placed on ringsof constant latitude, and are equidistant in azimuth (on eachring). All isolatitude rings located between the upper and lowercorners of the equatorial base-resolution pixels (i.e., !2

3 <cos ! < 2

3), or in the equatorial zone, are divided into the samenumber of pixels: Neq " 4Nside. The remaining rings are locatedwithin the polar cap regions ( cos !j j > 2

3) and contain a varyingnumber of pixels, increasing from ring to ring, with increasingdistance from the poles, by one pixel within each quadrant. AHEALPix map hasNpix " 12N 2

side pixels of the same area!pix ""=(3N 2

side).

4.1. Pixel Positions

For a resolution parameter Nside, the pixels are laid out on4Nside ! 1 isolatitude rings.

The locations of pixel centers on the sphere are defined by(z # cos !; #), where !2 $0; "% is the colatitude in radians mea-sured from the north pole and #2 $0; 2"% is the longitude in

radians measured eastward. Pixel centers on the northern hemi-sphere are given by the following equations:

North polar cap.— For ph " ( p& 1)=2, the ring index 1 'i < Nside, and the pixel-in-ring index 1 ' j ' 4i, where

i " I

!!!!!!!!!!!!!!!!!!!!!!!!!!ph !

!!!!!!!!!!!I ph( )

pq" #& 1; (2)

j " p& 1! 2i(i! 1); (3)

z " 1! i2

3N 2side

; (4)

# " "

2ij! s

2

$ %; and s " 1: (5)

North equatorial belt.—For p0 " p! 2Nside(Nside!1),Nside 'i ' 2Nside, and 1 ' j ' 4Nside, where

i " I p0=4 Nside( ) & Nside; (6)

j " p0mod4 Nside( ) & 1; (7)

z " 4

3! 2i

3Nside; (8)

# " "

2 Nsidej! s

2

$ %; and s " (i! Nside & 1) mod 2; (9)

where the auxiliary index s describes the phase shifts along therings and I(x) is the largest integer number smaller than x.

Pixel center positions in the southern hemisphere are obtained bythemirror symmetry of the grid with respect to the equator (z " 0).One can check that the discretized area element "z"#j j"!pix is aconstant by defining"z and"# as the variation of z and # when iand j, respectively, are increased by unity.

4.2. Pixel Indexing

Specific geometrical properties allow HEALPix to supporttwo different numbering schemes for the pixels, as illustrated inFigure 4.

First, in the ring scheme, one can simply count the pixels mov-ing down from the north to the south pole along each isolatitudering. It is in this scheme that Fourier transforms with sphericalharmonics are easy to implement. Second, one can replicate thetree structure of pixel numbering used, e.g., with the QuadCube.This can easily be implemented since, because of the simpledescription of pixel boundaries, the analytical mapping of theHEALPix base-resolution elements (curvilinear quadrilaterals)into a $0; 1% ; $0; 1% square exists. This tree structure, aka nestedscheme, allows one to implement efficiently all applications in-volving nearest-neighbor searches (Wandelt et al. 1998), andalso allows for an immediate construction of the fast Haar wave-let transform on HEALPix.

The base-resolution pixel index number f runs in 0; N!N# !&

1g"f 0; 11g. Introducing the row index

frow " I f =N#

' (; (10)

we define two functions that index the location of the south-ernmost corner (or vertex) of each base-resolution pixel on thesphere in latitude and longitude, respectively:

F1( f )" frow & 2; (11)

F2( f ) " 2 f mod N#

' (! frowmod 2( ) & 1: (12)

Fig. 3.—Orthographic view of the HEALPix partition of the sphere. Theoverplot of equator and meridians illustrates the octahedral symmetry ofHEALPix. Light gray shading shows one of the 8 (4 north and 4 south) identicalpolar base-resolution pixels. Dark gray shading shows one of the 4 identicalequatorial base-resolution pixels. Moving clockwise from the top left panel, thegrid is hierarchically subdivided with the grid resolution parameter equal toNside " 1, 2, 4, 8, and the corresponding total number of pixels equal toNpix " 12 ;N2

side " 12, 48, 192, 768. All pixel centers are located on Nring "4Nside ! 1 rings of constant latitude. Within each panel the areas of all pixels areidentical.

11 It should be noted that the WMAP team uses an alternative notation fordefining various levels of resolution. Specifically, they refer to a ‘‘resolutionlevel’’ defined by Nside " 2k, where k can adopt the integer values 0, 1, 2, . . . .

HEALPix 763

Page 23: VO Course 11: Spatial indexing

HEALPix

should be retained for reasons related to the fast harmonictransform.

This preferred implementation, which is referred to asHEALPix, is a geometrically constructed, self-similar, refinablequadrilateral mesh on the sphere as shown in Figure 3. The baseresolution comprises 12 pixels in three rings around the polesand equator. The resolution of the grid is expressed by the pa-rameter Nside, which defines the number of divisions along theside of a base-resolution pixel that is needed to reach a desiredhigh-resolution partition.11 All pixel centers are placed on ringsof constant latitude, and are equidistant in azimuth (on eachring). All isolatitude rings located between the upper and lowercorners of the equatorial base-resolution pixels (i.e., !2

3 <cos ! < 2

3), or in the equatorial zone, are divided into the samenumber of pixels: Neq " 4Nside. The remaining rings are locatedwithin the polar cap regions ( cos !j j > 2

3) and contain a varyingnumber of pixels, increasing from ring to ring, with increasingdistance from the poles, by one pixel within each quadrant. AHEALPix map hasNpix " 12N 2

side pixels of the same area!pix ""=(3N 2

side).

4.1. Pixel Positions

For a resolution parameter Nside, the pixels are laid out on4Nside ! 1 isolatitude rings.

The locations of pixel centers on the sphere are defined by(z # cos !; #), where !2 $0; "% is the colatitude in radians mea-sured from the north pole and #2 $0; 2"% is the longitude in

radians measured eastward. Pixel centers on the northern hemi-sphere are given by the following equations:

North polar cap.— For ph " ( p& 1)=2, the ring index 1 'i < Nside, and the pixel-in-ring index 1 ' j ' 4i, where

i " I

!!!!!!!!!!!!!!!!!!!!!!!!!!ph !

!!!!!!!!!!!I ph( )

pq" #& 1; (2)

j " p& 1! 2i(i! 1); (3)

z " 1! i2

3N 2side

; (4)

# " "

2ij! s

2

$ %; and s " 1: (5)

North equatorial belt.—For p0 " p! 2Nside(Nside!1),Nside 'i ' 2Nside, and 1 ' j ' 4Nside, where

i " I p0=4 Nside( ) & Nside; (6)

j " p0mod4 Nside( ) & 1; (7)

z " 4

3! 2i

3Nside; (8)

# " "

2 Nsidej! s

2

$ %; and s " (i! Nside & 1) mod 2; (9)

where the auxiliary index s describes the phase shifts along therings and I(x) is the largest integer number smaller than x.

Pixel center positions in the southern hemisphere are obtained bythemirror symmetry of the grid with respect to the equator (z " 0).One can check that the discretized area element "z"#j j"!pix is aconstant by defining"z and"# as the variation of z and # when iand j, respectively, are increased by unity.

4.2. Pixel Indexing

Specific geometrical properties allow HEALPix to supporttwo different numbering schemes for the pixels, as illustrated inFigure 4.

First, in the ring scheme, one can simply count the pixels mov-ing down from the north to the south pole along each isolatitudering. It is in this scheme that Fourier transforms with sphericalharmonics are easy to implement. Second, one can replicate thetree structure of pixel numbering used, e.g., with the QuadCube.This can easily be implemented since, because of the simpledescription of pixel boundaries, the analytical mapping of theHEALPix base-resolution elements (curvilinear quadrilaterals)into a $0; 1% ; $0; 1% square exists. This tree structure, aka nestedscheme, allows one to implement efficiently all applications in-volving nearest-neighbor searches (Wandelt et al. 1998), andalso allows for an immediate construction of the fast Haar wave-let transform on HEALPix.

The base-resolution pixel index number f runs in 0; N!N# !&

1g"f 0; 11g. Introducing the row index

frow " I f =N#

' (; (10)

we define two functions that index the location of the south-ernmost corner (or vertex) of each base-resolution pixel on thesphere in latitude and longitude, respectively:

F1( f )" frow & 2; (11)

F2( f ) " 2 f mod N#

' (! frowmod 2( ) & 1: (12)

Fig. 3.—Orthographic view of the HEALPix partition of the sphere. Theoverplot of equator and meridians illustrates the octahedral symmetry ofHEALPix. Light gray shading shows one of the 8 (4 north and 4 south) identicalpolar base-resolution pixels. Dark gray shading shows one of the 4 identicalequatorial base-resolution pixels. Moving clockwise from the top left panel, thegrid is hierarchically subdivided with the grid resolution parameter equal toNside " 1, 2, 4, 8, and the corresponding total number of pixels equal toNpix " 12 ;N2

side " 12, 48, 192, 768. All pixel centers are located on Nring "4Nside ! 1 rings of constant latitude. Within each panel the areas of all pixels areidentical.

11 It should be noted that the WMAP team uses an alternative notation fordefining various levels of resolution. Specifically, they refer to a ‘‘resolutionlevel’’ defined by Nside " 2k, where k can adopt the integer values 0, 1, 2, . . . .

HEALPix 763

Page 24: VO Course 11: Spatial indexing

HEALPix

should be retained for reasons related to the fast harmonictransform.

This preferred implementation, which is referred to asHEALPix, is a geometrically constructed, self-similar, refinablequadrilateral mesh on the sphere as shown in Figure 3. The baseresolution comprises 12 pixels in three rings around the polesand equator. The resolution of the grid is expressed by the pa-rameter Nside, which defines the number of divisions along theside of a base-resolution pixel that is needed to reach a desiredhigh-resolution partition.11 All pixel centers are placed on ringsof constant latitude, and are equidistant in azimuth (on eachring). All isolatitude rings located between the upper and lowercorners of the equatorial base-resolution pixels (i.e., !2

3 <cos ! < 2

3), or in the equatorial zone, are divided into the samenumber of pixels: Neq " 4Nside. The remaining rings are locatedwithin the polar cap regions ( cos !j j > 2

3) and contain a varyingnumber of pixels, increasing from ring to ring, with increasingdistance from the poles, by one pixel within each quadrant. AHEALPix map hasNpix " 12N 2

side pixels of the same area!pix ""=(3N 2

side).

4.1. Pixel Positions

For a resolution parameter Nside, the pixels are laid out on4Nside ! 1 isolatitude rings.

The locations of pixel centers on the sphere are defined by(z # cos !; #), where !2 $0; "% is the colatitude in radians mea-sured from the north pole and #2 $0; 2"% is the longitude in

radians measured eastward. Pixel centers on the northern hemi-sphere are given by the following equations:

North polar cap.— For ph " ( p& 1)=2, the ring index 1 'i < Nside, and the pixel-in-ring index 1 ' j ' 4i, where

i " I

!!!!!!!!!!!!!!!!!!!!!!!!!!ph !

!!!!!!!!!!!I ph( )

pq" #& 1; (2)

j " p& 1! 2i(i! 1); (3)

z " 1! i2

3N 2side

; (4)

# " "

2ij! s

2

$ %; and s " 1: (5)

North equatorial belt.—For p0 " p! 2Nside(Nside!1),Nside 'i ' 2Nside, and 1 ' j ' 4Nside, where

i " I p0=4 Nside( ) & Nside; (6)

j " p0mod4 Nside( ) & 1; (7)

z " 4

3! 2i

3Nside; (8)

# " "

2 Nsidej! s

2

$ %; and s " (i! Nside & 1) mod 2; (9)

where the auxiliary index s describes the phase shifts along therings and I(x) is the largest integer number smaller than x.

Pixel center positions in the southern hemisphere are obtained bythemirror symmetry of the grid with respect to the equator (z " 0).One can check that the discretized area element "z"#j j"!pix is aconstant by defining"z and"# as the variation of z and # when iand j, respectively, are increased by unity.

4.2. Pixel Indexing

Specific geometrical properties allow HEALPix to supporttwo different numbering schemes for the pixels, as illustrated inFigure 4.

First, in the ring scheme, one can simply count the pixels mov-ing down from the north to the south pole along each isolatitudering. It is in this scheme that Fourier transforms with sphericalharmonics are easy to implement. Second, one can replicate thetree structure of pixel numbering used, e.g., with the QuadCube.This can easily be implemented since, because of the simpledescription of pixel boundaries, the analytical mapping of theHEALPix base-resolution elements (curvilinear quadrilaterals)into a $0; 1% ; $0; 1% square exists. This tree structure, aka nestedscheme, allows one to implement efficiently all applications in-volving nearest-neighbor searches (Wandelt et al. 1998), andalso allows for an immediate construction of the fast Haar wave-let transform on HEALPix.

The base-resolution pixel index number f runs in 0; N!N# !&

1g"f 0; 11g. Introducing the row index

frow " I f =N#

' (; (10)

we define two functions that index the location of the south-ernmost corner (or vertex) of each base-resolution pixel on thesphere in latitude and longitude, respectively:

F1( f )" frow & 2; (11)

F2( f ) " 2 f mod N#

' (! frowmod 2( ) & 1: (12)

Fig. 3.—Orthographic view of the HEALPix partition of the sphere. Theoverplot of equator and meridians illustrates the octahedral symmetry ofHEALPix. Light gray shading shows one of the 8 (4 north and 4 south) identicalpolar base-resolution pixels. Dark gray shading shows one of the 4 identicalequatorial base-resolution pixels. Moving clockwise from the top left panel, thegrid is hierarchically subdivided with the grid resolution parameter equal toNside " 1, 2, 4, 8, and the corresponding total number of pixels equal toNpix " 12 ;N2

side " 12, 48, 192, 768. All pixel centers are located on Nring "4Nside ! 1 rings of constant latitude. Within each panel the areas of all pixels areidentical.

11 It should be noted that the WMAP team uses an alternative notation fordefining various levels of resolution. Specifically, they refer to a ‘‘resolutionlevel’’ defined by Nside " 2k, where k can adopt the integer values 0, 1, 2, . . . .

HEALPix 763

Page 25: VO Course 11: Spatial indexing

HEALPix

Fig. 4.—Layout of the HEALPix pixels on the sphere in a cylindrical projection and a demonstration of two possible pixel indexations—one running onisolatitude rings, the other arranged hierarchically or in a nested tree fashion. The top two panels correspond to Nside ! 2 in first ring then nested schemes; the bottomtwo panels are for Nside ! 4. ! refers to the colatitude and " to the longitude.

Page 26: VO Course 11: Spatial indexing

HEALPix

Fig. 4.—Layout of the HEALPix pixels on the sphere in a cylindrical projection and a demonstration of two possible pixel indexations—one running onisolatitude rings, the other arranged hierarchically or in a nested tree fashion. The top two panels correspond to Nside ! 2 in first ring then nested schemes; the bottomtwo panels are for Nside ! 4. ! refers to the colatitude and " to the longitude.

0011 0111 1011 1111

Page 27: VO Course 11: Spatial indexing

HEALPix

Fig. 4.—Layout of the HEALPix pixels on the sphere in a cylindrical projection and a demonstration of two possible pixel indexations—one running onisolatitude rings, the other arranged hierarchically or in a nested tree fashion. The top two panels correspond to Nside ! 2 in first ring then nested schemes; the bottomtwo panels are for Nside ! 4. ! refers to the colatitude and " to the longitude.

10100 10101 10110 10111

Page 28: VO Course 11: Spatial indexing

HEALPix

Fig. 4.—Layout of the HEALPix pixels on the sphere in a cylindrical projection and a demonstration of two possible pixel indexations—one running onisolatitude rings, the other arranged hierarchically or in a nested tree fashion. The top two panels correspond to Nside ! 2 in first ring then nested schemes; the bottomtwo panels are for Nside ! 4. ! refers to the colatitude and " to the longitude.

Page 29: VO Course 11: Spatial indexing

HEALPix

Fig. 4.—Layout of the HEALPix pixels on the sphere in a cylindrical projection and a demonstration of two possible pixel indexations—one running onisolatitude rings, the other arranged hierarchically or in a nested tree fashion. The top two panels correspond to Nside ! 2 in first ring then nested schemes; the bottomtwo panels are for Nside ! 4. ! refers to the colatitude and " to the longitude.

Page 30: VO Course 11: Spatial indexing

Astronomy & Astrophysics manuscript no. mhg June 20, 2005(DOI: will be inserted by hand later)

Mapping on the HEALPix grid

M. R. Calabretta1 and B. F. Roukema2

1 Australia Telescope National Facility, PO Box 76, Epping, NSW 1710, Australia2 Torun Centre for Astronomy, N. Copernicus University, ul. Gagarina 11, PL-87-100 Torun, Poland

Draft dated 2005/06/15

Abstract. The natural spherical projection associated with the Hierarchical Equal Area and isoLatitude Pixelisation, HEALPix,is described and shown to be one of a hybrid class that combines the cylindrical equal-area and Collignon projections, notpreviously documented in the cartographic literature. Projection equations are derived for the class in general and it is shownthat the HEALPix projection suggests a simple method (a) of storing, and (b) visualising data sampled on the grid of theHEALPix pixelisation, and also suggests an extension of the pixelisation that is better suited for these purposes. Potentiallyuseful properties of other members of the class are described, and new triangular and hexagonal pixelisations are constructedfrom them. Finally, the formalism is defined for representing the celestial coordinate system for any member of the class in theFITS data format.

Key words. astronomical data bases: miscellaneous – cosmic microwave background – cosmology: observations – methods:data analysis, statistical – techniques: image processing

1. Introduction

The Hierarchical Equal Area and isoLatitude Pixelisation,HEALPix (Gorski et al. 2004), o↵ers a scheme for distributing12N2(N 2 ) points as uniformly as possible over the surfaceof the unit sphere subject to the constraint that the points lie ona relatively small number (4N � 1) of parallels of latitude andare equispaced in longitude on each of these parallels. Theseproperties were chosen to optimise spherical harmonic analy-sis and other computations performed on the sphere.

In fact, HEALPix goes further than simply defining a dis-tribution of points; it also specifies the boundary between ad-jacent points and does so in such a way that each occupies thesame area. Thus HEALPix is described as an equal area pix-elisation. Pixels at the same absolute value of the latitude havethe same shape in the equatorial region, though pixel shape dif-fers between latitudes, and with longitude in the polar regions.The boundaries for N = 1 define the 12 base-resolution pix-els and higher-order pixelisations are defined by their regularsubdivision. Note, however, that although they are four-sided,HEALPix pixels are not spherical quadrilaterals because theiredges are not great circle arcs.

HEALPix was originally described purely with referenceto the sphere, the data itself being stored as a one-dimensionalarray in a FITS binary table (Cotton et al. 1995) with eitherring or nested organisation, the former being suited for spher-ical harmonic analysis and the latter for nearest-neighboursearches. For visualisation purposes the software that imple-

Send o↵print requests to: M. Calabretta,e-mail: [email protected]

0

-9090-1200120

-180-90090180-60-45

4560

-135-4545135

-75-60

-30-15

0

1530

6075

90

Fig. 1. The HEALPix class of projections for H = 1, 2, 3 rescaled tounit area (top), and the nominative case with H = 4 (bottom) at twicethe linear scale and with the top left-hand corner of the graticule “cutaway” to reveal the underlying cylindrical equal-area projection in theequatorial region. Facets are shown as dashed diamonds.

ments HEALPix o↵ers a choice of four conventional projectiontypes onto which HEALPix data may be regridded.

HEALPix & FITS

Page 31: VO Course 11: Spatial indexing

HEALPix & FITSM. R. Calabretta: Mapping on the HEALPix grid 5

-1200120

-75

-60-45

-30

-15

0

15

30

4560

75

Fig. 5.HEALPix projection for H = 3 scaled in ! by 1/!3 whereupon

it becomes three consecutive hexagons.

by equilateral triangles. This pixelisation may be defined by

rescaling the HEALPix projection with H = 6 by!3 in !

so that the half-facets become equilateral triangles. Such a lin-

ear scaling does not a!ect the projection’s equal area property.

What were previously half-facets may now be identified with

36 new, triangular base-resolution pixels that may be subdi-

vided in a hierarchical way as for HEALPix, as depicted in

Fig. 4. It is interesting to note that this subdivision is natu-

rally hierarchical - the number of pixels varies exponentially as

36"4N#1 where N is the hierarchy level. In the H = 4 pixelisa-tion the exponential hierarchy must be engineered by doubling

N.

The conformal latitude computed for H = 6 with this

extra !-scaling is !$ = 30.$98, indicating that the projec-

tion becomes conformal at the latitude that bisects the hemi-

sphere by area. Applying Eqs. (13) and (14) with the extra

scaling gives!3H$ = (8.2, 7.6, 6.1, 4.5, 4.6, 5.1, 5.3, 5.4) for

! = (0, 15, 30, !", 45, 60, 75, 90), again indicating less distor-tion in the polar regions than H = 4. It also does better in

the polar zone away from the centreline because the 60$ angle

along the edge of the polar facets more closely matches the true

angle of 90$ on the sphere. Overall, this pixelisation performs

adequately at low latitudes and does better than the H = 4 pix-

elisations at mid to high latitudes.

This rescaling of the H = 6 projection is reminiscent of

Tegmark’s (1996) icosahedral projection composed of 20 equi-

lateral triangles; the problem of indexing the subdivisions of its

triangular facets was solved in the implementation of the cor-

responding pixelisation. In the present context the iso-latitude

property is still present but modified somewhat from the dia-

mond pixelisation of H = 4. However, if the pixel centres are

moved up or down from the centroid by 112of the height of

the equilateral triangles to the point half-way between the base

and apex then they fall onto a regular grid sampled more fre-

quently in x than y. This provides some of the same benefits as

the H = 4 double-pixelisation.

However, although the displacement is small, there is a pos-

sibility that it will introduce statistical biases so the full con-

sequences should be investigated for a particular application.

These potential biases may be minimised by making the pixel

size su"ciently small, and the fact that the bias between ad-

jacent pairs of pixels is in opposite senses will tend to cancel

them over a region encompassing a su"cient number of pixels.

It should also be remembered that although the pixel locations

appear to be at the centre of the pixel boundary in the projec-

tion of the diamond, square, and triangular pixelisations this

is very much an artifact of the distortions inherent in the pro-

jection. Because the !-coordinate varies non-linearly with !,on the sphere they are actually biased to one side of the pixel.

Hence some degree of bias is unavoidable.

2.3.2. Hexagonal – H = 3

The division into 3 " 120$ suggests hexagonal base-resolutionpixels. Although the familiar “honeycomb” structure shows

that it is possible to tile the plane with hexagons, neverthe-

less there is no bounded tesselation of hexagons by hexagons.

That is, a hexagonal region may not be cut out of a honey-

comb tesselation without cutting the individual elements. Thus

it may seem surprising that a hexagonal pixelisation can be con-

structed from the HEALPix projection for H = 3 with ! scaled

by 1/!3. The boundary of this projection, as seen in Fig. 5, is

reduced to that of three sequential hexagons. This boundary is

then used conceptually as a “pie-cutter” on a honeycomb tesse-

lation of the right scale. Pixels that are cut can be made whole

again by borrowing from adjacent facets, much as the square

pixelisation in Fig. 3 does.

Rescaling Eqs. (13) and (14) gives H$/!3 = (2.7, 2.5,

2.0, 1.5, 1.5, 1.7, 1.8, 1.8) for ! = (0, 15, 30, !", 45, 60, 75, 90).

Thus the rescaled H = 3 projection does not achieve confor-

mality at any latitude, it does well close to the equator, but

degrades at mid-latitudes. In the polar regions the 30$ angle

between meridians and parallels along the edge of the facets

is further from the ideal of 90$ than the 45$ for the unscaled

projections.

2.4. HPX: HEALPix in FITS

In this section the HEALPix projections are described in the

same terms as the projections defined in Calabretta & Greisen

(2002).

HEALPix projections will be denoted in FITS with algo-

rithm code HPX in the CTYPE ia keywords for the celestial axes.

As data storage has become much less of an issue in recent

years we do not consider it necessary to create an analogue of

the CUBEFACE keyword to cover HPX. However, if HEALPix

data is repackaged into the pseudo-quadcube layout shown

in Fig. 3 the CUBEFACE storage mechanism is applicable for

H = 4 and will be treated properly by !"#$%& (Calabretta,

1995).

Since the HEALPix projections are constructed with the

origin of the native coordinate system at the reference point,

we set

("0, !0)HEALPix = (0, 0). (15)

The projection equations and their inverses, re-expressed in the

form required by FITS, are now summarised formally.

In the equatorial zone where | sin ! | % 2/3:

x = ", (16)

! =270$

Hsin !, (17)

in the polar zones, where | sin ! | > 2/3:

x = "c + (" # "c)#, (18)

Page 32: VO Course 11: Spatial indexing

HEALPix & FITSSIMPLE = T /FITS FORMATBITPIX = 16 /DUMMY PRIMARY HEADERNAXIS = 0 /NO DATA IS ASSOCIATED WITH THIS HEADEREXTEND = T /EXTENSIONS MAY (WILL!) BE PRESENTRESOLUTN= 9 /RESOLUTION INDEXPIXTYPE = 'HEALPIX ' /PIXEL ALGORIGTHMORDERING= 'NESTED ' /ORDERING SCHEMENSIDE = 512 /RESOLUTION PARAMETERFIRSTPIX= 0 /FIRST PIXEL (0 BASED)LASTPIX = 3145727 /LAST PIXEL (0 BASED)COMMENT THIS FILE CONTAINS A WMAP INTENSITY (I) RES 9 SKYMAP FOR THECOMMENT FREQUENCY BAND INDICATED BY THE FREQ KEYWORD.COMMENT FIVE YEARS OF DATA WENT INTO THE MAP.DATE = '2008-01-02T18:32:00' /FILE CREATION DATE (YYYY-MM-DDTHH:MM:SS UT)TELESCOP= 'WMAP ' /WILKINSON MICROWAVE ANISOTROPY PROBEREFERENC= 'WMAP EXPLANATORY SUPPLEMENT: HTTP://LAMBDA.GSFC.NASA.GOV/' /STOKES = 'I ' /FREQ = 'KA BAND ' /FREQUENCY BANDRELEASE = 'DR3 ' /WMAP RELEASEEND

Page 33: VO Course 11: Spatial indexing

HEALPix & FITSXTENSION= 'BINTABLE' /BINARY TABLE EXTENSIONBITPIX = 8 /8-BIT BYTESNAXIS = 2 /2-DIMENSIONAL BINARY TABLENAXIS1 = 8 /WIDTH OF TABLE IN BYTESNAXIS2 = 3145728 /NUMBER OF ROWS IN TABLEPCOUNT = 0 /SIZE OF SPECIAL DATA AREAGCOUNT = 1 /ONE DATA GROUP (REQUIRED KEYWORD)TFIELDS = 2 /NUMBER OF FIELDS IN EACH ROWTTYPE1 = 'TEMPERATURE ' /LABEL FOR FIELD 1TFORM1 = 'E ' /DATA FORMAT OF FIELD: 4-BYTE REALTUNIT1 = 'MK ' /PHYSICAL UNIT OF FIELD 1TTYPE2 = 'N_OBS ' /LABEL FOR FIELD 2TFORM2 = 'E ' /DATA FORMAT OF FIELD: 4-BYTE REALTUNIT2 = 'COUNTS ' /PHYSICAL UNIT OF FIELD 2EXTNAME = 'ARCHIVE MAP TABLE' /NAME OF THIS BINARY TABLE EXTENSIONPIXTYPE = 'HEALPIX ' /PIXEL ALGORIGTHMORDERING= 'NESTED ' /ORDERING SCHEMENSIDE = 512 /RESOLUTION PARAMETERFIRSTPIX= 0 /FIRST PIXEL (0 BASED)LASTPIX = 3145727 /LAST PIXEL (0 BASED)END

Page 34: VO Course 11: Spatial indexing

XTENSION= 'BINTABLE' /BINARY TABLE EXTENSIONBITPIX = 8 /8-BIT BYTESNAXIS = 2 /2-DIMENSIONAL BINARY TABLENAXIS1 = 8 /WIDTH OF TABLE IN BYTESNAXIS2 = 3145728 /NUMBER OF ROWS IN TABLEPCOUNT = 0 /SIZE OF SPECIAL DATA AREAGCOUNT = 1 /ONE DATA GROUP (REQUIRED KEYWORD)TFIELDS = 2 /NUMBER OF FIELDS IN EACH ROWTTYPE1 = 'TEMPERATURE ' /LABEL FOR FIELD 1TFORM1 = 'E ' /DATA FORMAT OF FIELD: 4-BYTE REALTUNIT1 = 'MK ' /PHYSICAL UNIT OF FIELD 1TTYPE2 = 'N_OBS ' /LABEL FOR FIELD 2TFORM2 = 'E ' /DATA FORMAT OF FIELD: 4-BYTE REALTUNIT2 = 'COUNTS ' /PHYSICAL UNIT OF FIELD 2EXTNAME = 'ARCHIVE MAP TABLE' /NAME OF THIS BINARY TABLE EXTENSIONPIXTYPE = 'HEALPIX ' /PIXEL ALGORIGTHMORDERING= 'NESTED ' /ORDERING SCHEMENSIDE = 512 /RESOLUTION PARAMETERFIRSTPIX= 0 /FIRST PIXEL (0 BASED)LASTPIX = 3145727 /LAST PIXEL (0 BASED)END

Page 35: VO Course 11: Spatial indexing

HTM

Page 36: VO Course 11: Spatial indexing

HTM

By Szalay, Gray, et al.

Hierarchical, multiresolution search system with support for region operations

Basis for spatial support in MS SQL Server, SDSS

Page 37: VO Course 11: Spatial indexing

HTM

By Szalay, Gray, et al.

Hierarchical, multiresolution search system with support for region operations

Basis for spatial support in MS SQL Server, SDSS

1

Indexing the Sphere with the Hierarchical Triangular Mesh Alexander S. Szalay1, Jim Gray2, George Fekete1 Peter Z. Kunszt3,

Peter Kukol2, and Ani Thakar1

1. Dept of Physics and Astronomy, The Johns Hopkins University, Baltimore 2. Microsoft Research Bay Area Research Center, San Francisco 3. CERN, Geneva

Abstract: We describe a method to subdivide the surface of a sphere into spherical triangles of

similar, but not identical, shapes and sizes. The Hierarchical Triangular Mesh (HTM) is a quad-tree that is particularly good at supporting searches at different resolutions, from arc seconds to hemispheres. The subdivision scheme is universal, providing the basis for addressing and for fast lookups. The HTM provides the basis for an efficient geospatial indexing scheme in relational databases where the data have an inherent location on either the celestial sphere or the Earth. The HTM index is superior to cartographical methods using coordinates with singularities at the poles. We also describe a way to specify surface regions that efficiently represent spherical query areas. This article presents the algorithms used to identify the HTM triangles covering such regions.

1. Introduction

Many science and commercial applications must catalog and search objects in three-dimensional space. In Earth and Space Science, the coordinate system is usually spherical, so the object’s position is given by its location on the surface of the unit sphere and its distance from the origin. Queries on catalogs of such objects often involve constraints on these coordinates, often in terms of complex regions that imply complicated spherical trigonometry.

There is a great interest in a universal, computer-friendly index on the sphere, especially in astronomy, where the ancient index of stellar constellations is still in common use, and in earth sciences, where people use maps having complicated spherical projections. The spatial index presented here transforms regions of the sphere to unique identifiers (IDs). These IDs can be used both as an identifier for an area and as an indexing strategy. The transformation uses only elementary spherical geometry to identify a certain area. It provides universality, which is essential for cross-referencing across different datasets. The comparisons are especially well-suited for computers because they replace transcendental functions with a few multiplications and additions.

The technique to subdivide the sphere into spherical triangles presented here is recursive. At each level of recursion, the triangle areas are roughly the same (within a factor of 2), which is a major advantage over the usual spherical coordinate system projections with singularities at the poles. Also, in areas with high data density, the recursion process can be applied to a higher level than in areas where data points are rare. This enables uneven data distributions to be organized into equal-sized bins.

A similar scheme for subdividing the sphere was advocated by Barrett [1]. The idea of the current implementation of the HTM was described in Kunszt et al [2]. Short, Fekete et al [3,4,5] used an icosahedron-based mesh for Earth sciences applications. Quad trees and geometrical indexing are discussed in the books of Samet in detail [6,7]. Lee and Samet [8] use an identical triangulation, but a different numbering scheme. Goodchild [9,10] and Song et al [11] created a similar triangulation of the sphere, called the Discrete Global Grid, with precisely equal areas, using small circles for the hierarchical boundaries. Gray et al [12] described linking the HTM to a relational database system.

Page 38: VO Course 11: Spatial indexing

HTM

2

2. The Hierarchical Triangular Mesh

2.1. Using Cartesian Coordinates

Performing computations on the surface of the sphere generally involves complicated transcendental functions with singularities at the spherical coordinate system poles. In these coordinate systems, it is typically computationally expensive to evaluate even simple tests like point-inside-circle or circle-overlap-circle. The HTM approach uses a three-dimensional vector representation to circumvent these problems. By going from the two-dimensional spherical surface to three-dimensional volumes containing the surface area, point-in-polygon computations avoid transcendental computations and need just a few

multiplications and additions, and a compare.

2.2. Starting the Subdivision

The hierarchical subdivision of the sphere starts with eight spherical triangles of equal size – the octahedron projected onto the sphere as illustrated by Figure 1. A spherical triangle is given by three points on the unit sphere connected by great circle segments. The octahedron has six vertices, given by the intersection points of the x,y,z axes with the unit sphere, which we enumerate v0 through v5:

1

2

3

4

5

( 0 0 1 ) :

( 1 0 0 ) :

( 0 1 0 ) :

( 1 0 0 ) :

( 0 1 0 ) :

( 0 0 1 ) :

o, , =

, , =

, , =

! , , =

, ! , =

, , ! =

v

v

v

v

v

v

(2.1)

The first eight nodes of the HTM index are defined as these eight spherical triangles named by using S for south and N for north, and then numbering the faces clockwise:

Figure 1 The Hierarchal Triangular Mesh (HTM) is a recursive decomposition of the sphere. The figures above show the sequence of subdivisions, starting from the octahedron, down to level 5 corresponding to 8192 spherical triangles. The triangles have been plotted as planar ones for simplicity.

Page 39: VO Course 11: Spatial indexing

HTM

5

0

2

4

6

8

10

0.6 0.8 1 1.2 1.4 1.6

relative area

frequency

0

2

4

6

8

10

0.6 0.8 1 1.2 1.4 1.6

relative arc length

0

2

4

6

8

10

0.6 0.8 1 1.2 1.4 1.6

relative area

frequency

0

2

4

6

8

10

0.6 0.8 1 1.2 1.4 1.6

relative arc length

Figure 3 The distribution of relative spherical trixel areas and arc lengths around the mean at HTM depth 7. The scatter arises mainly from the difference in size of the center triangle from the corner ones at depth 2. Subsequent subdivisions smear out the ratios some, but the curvature plays a diminishing role at higher depths.

depth 7 triangles is 15 percent, and the ratio of the average arc length to the canonical size /2n is about 1.23.

3. Defining the Geometry

The HTM index must support intersections with arbitrary spherical regions. Given a region, we want to get all HTM trixels of a given depth that cover it. We call this set of trixels the region’s HTM cover. This section presents the geometry primitives that define spherical areas. These primitives can easily be intersected with a trixel to categorize it as inside, outside, or partially overlapping the region. When the algorithms to represent and simplify a region are in place, we tackle the HTM cover computation.

3.1. Halfspaces

The halfspace is our basic geometry primitive. Each halfspace defines a cap, h, on the unit sphere that is inside the halfspace and so is sliced off by the plane that bounds the halfspace. Any halfspace can be characterized by the plane that bounds it and a direction from that plane. For our purposes, it is

convenient to define the halfspace by (i) the vector, v

, from the origin pointing into the halfspace and normal to the halfspace’s bounding plane, and (ii) the distance d to the plane from the origin along the

vector v

:

{ } 1 1 1c v d v d:= ; | |= ; ! " "

(3.1)

Negative halfspaces, d<0, cover more than half of the spherical surface. They are holes on the sphere. The sign of the halfspace is defined to be the sign of d:

sign( ) : sign( )c d= (3.2)

We also define the arcangle of a halfspace:

arccos( )c d# = (3.3)

Examples:

{v,d}=(0,0,1,0.5) defines the cap north of 30°N latitude with angle 30°, {v,d}=(0,0,-1,-0.5) defines the area below 30°N latitude and has a 150° angle.

Page 40: VO Course 11: Spatial indexing

HTM vs. HEALPix

William O’Mullane 20/7/00 2/20

Splitting the sky - HTM & HEALPix.Planck

Motivation

HTM - searches in spherical space

• Index the sphere

• support spherical trigono-

metrics.

• Support data binning

• Hierarchical for storage

HEALPix - spherical images

• Numerical analysis -

• convolutions local/global

kernel

• Fourier analysis with

spherical harmonics

• power spectrum estimation

• Topological analysis

• extreme searches

• neighbour searches

• Minkowski functionals

• To aid above should have

• equal area pixels

• iso latitude distribution

• Hierarchical for storage

Page 41: VO Course 11: Spatial indexing

HTM vs. HEALPix

William O’Mullane 20/7/00 12/20

Splitting the sky - HTM & HEALPix.Planck

HEALPix

• Pixel shape varies - not a problem with

high enough sampling

• need to take account of posi-

tion on the sphere (3 rules)

• number of pixels in rings vary

• Most pixels have 8 neighbours - 8 have 7

neighbours

• Nested X,Y orientation of base pixel

neighbours varies

Special Considerations

Anomalies are inevitable with any tessellation.

HTM

• Pixel shape varies

• Pixel area varies - makes many numeri-

cal calculations difficult.

• no rings

• similar neighbour orientation problem

These are mainly problems for developers not particularly for users

Advanced libraries exist for both schemes although target audiences are different.

Page 42: VO Course 11: Spatial indexing

Q3C

Page 43: VO Course 11: Spatial indexing

Q3C

By Kortosov & Barkunov (Sternberg Astronomical Institute)

Implementation of a faster, open-source, HTM-like partitioning

Not equal area

Alternative to pgSphere, not well documented yet

Page 44: VO Course 11: Spatial indexing

Q3C

SPHERE PARTITIONING

Page 45: VO Course 11: Spatial indexing

Q3C

CONESEARCH PIXELISATION

Page 46: VO Course 11: Spatial indexing

Using partitioning schemes

Display applications

Query applications

Spatial joins

X-Match applications

Page 47: VO Course 11: Spatial indexing

Partitioning & Cone Search

Page 48: VO Course 11: Spatial indexing

Partitioning & Cone Search

SELECT * FROM TARGET_TABLE WHERE 2 * ASIN( SQRT(SIN(($DEC_C-DEC)/2) * SIN(($DEC_C-DEC)/2) + COS($DEC_C) * COS(DEC) * SIN(($RA_C - RA)/2) * SIN(($RA_C - RA)/2))) <= $SR_C

SELECT * FROM RASS_PHOTONS WHERE X*$X_C+Y*$Y_C+Z*$Z_C >= COS($SR_C)

Page 49: VO Course 11: Spatial indexing

Partitioning & Cone Search

SELECT * FROM RASS_PHOTONS WHERE PIXEL_ID IN RESULTING_PIXEL_QUERY AND X*$X_C+Y*$Y_C+Z*$Z_C >= $COS_SR

Page 50: VO Course 11: Spatial indexing

Using Spatial Indexing in DatabasesJuan de Dios Santander Vela (IAA-CSIC)

Page 51: VO Course 11: Spatial indexing

Things to show

HTM and Transact SQL (MS SQL)

PostgreSQL and pgSphere

Hands on on PostgreSQL

SYBASE

SYBASE

Page 52: VO Course 11: Spatial indexing

HTM SQL API

Page 53: VO Course 11: Spatial indexing

HTM SQL APIMain PageMain Page ClassesClasses

Class ListClass List Class MembersClass Members

SphericalSpherical.HtmHtm.SqlSql

Spherical.Htm.Sql Class ReferenceSpherical.Htm.Sql Class Reference

Encapsulates the HTM procedures for use from SQL2005. More...

List of all members.

Static Public Member FunctionsStatic Public Member Functions

static SqlString fHtmVersionfHtmVersion ()

fHtmVersion()fHtmVersion() returns the version number of this htm library as a string

static long fHtmXyzfHtmXyz (double x, double y, double z)

fHtmXyz(x,y,z) returns the 20-deep HtmID of the given cartesian point. There are no error cases. All vectors are nomalized and 0,0,0 maps to 1,0,0

static long fHtmEqfHtmEq (double ra, double dec)

fHtmEq(ra,dec) returns the 20-deep HtmID of the given equatorial point. There are no error cases. all RA, folded to [0..360] and dec to [-90...90]

static long fHtmLatLonfHtmLatLon (double lat, double lon)

fHtm(lat,lon) returns the 20-deep HtmID of the given location. There are no error cases. all RA, folded to [0..360] and dec to [0...90]

static SqlDouble fDistanceEqfDistanceEq (double ra1, double dec1, double ra2, double dec2)

double fDistanceEq(ra1,dec1,ra2,dec2) returns distance in ArcMinutes between two points.

static SqlDouble fDistanceLatLonfDistanceLatLon (double lat1, double lon1, double lat2, double lon2)

double fDistanceLatLon(lat1,lon1,lat2,lon2) returns distance in ArcMinutes between two points.

static SqlDouble fDistanceXyzfDistanceXyz (double x1, double y1, double z1, double x2, double y2, double z2)

double fDistanceXyz(x1,y1,z1,x2,y2,z2) returns distance in ArcMinutes between two points.

static SqlString fHtmToStringfHtmToString (SqlInt64 HtmID)

fHtmToString(HtmID) returns varchar(max)a string describing the HtmID

static IEnumerable fHtmLatLonToXyzfHtmLatLonToXyz (SqlDouble lat, SqlDouble lon)

XyzTable(x,y,z) fHtmLatLonToXyz(lat, lon) converts an lat,lon point to a table with one row containing the cartesian point (x,y,z).

static IEnumerable fHtmEqToXyzfHtmEqToXyz (SqlDouble ra, SqlDouble dec)

XyzTable(x,y,z) fHtmEqToXyz(ra, dec) converts an equitorial point to a table with one row containing the cartesian point (x,y,z).

static IEnumerable fHtmXyzToLatLonfHtmXyzToLatLon (SqlDouble x, SqlDouble y, SqlDouble z)

LatLonTable(lat,lon) fHtmXyzToLatLon(x,y,z) converts the cartesian point (x,y,z) to a table with one row containing the equivalentlat,lon point.

static IEnumerable fHtmXyzToEqfHtmXyzToEq (SqlDouble x, SqlDouble y, SqlDouble z)

EqTable(ra, dec) fHtmXyzToEq(x,y,z) converts the cartesian point (x,y,z) to a table with one row containing the equivalent equitorial(ra,dec) point.

static IEnumerable fHtmToCenterPointfHtmToCenterPoint (SqlInt64 HtmID)

fHtmToCenterPoint(HtmID) converts an HTM triangle ID to an (x,y,z) vector of the HTM triangle centerpoint. and returns that vector as the only row of a table.

static IEnumerable fHtmToCornerPointsfHtmToCornerPoints (SqlInt64 HtmID)

fHtmToCornerPoints(HtmID) converts an HTM triangle ID to an table of three (x,y,z) vectors of the HTM triangle corners.

static IEnumerable fHtmCoverCircleLatLonfHtmCoverCircleLatLon (SqlDouble lat, SqlDouble lon, SqlDouble radiusArcMin)

fHtmCoverCircleLatLon(ra,dec,radiusArcMin) returns a trixel table (a list) covering the circle centered at that lat,lon, within that arc-minute radius. A trixel table is a list of HtmIDStart,HtmIDEnd pairs that describe the HTM triangles (all points of a triangle are between its HtmIDStart and HtmIDEnd.

static IEnumerable fHtmCoverCircleEqfHtmCoverCircleEq (SqlDouble ra, SqlDouble dec, SqlDouble radiusArcMin)

fHtmCoverCircleEq(ra,dec,radiusArcMin) returns a trixel table (a list) covering the circle centered at that J2000 ra,dec, within that arc-minute radius. A trixel table is a list of HtmStart,HtmStop pairs that describe the HTM triangles (all points of a triangle are between its HtmStart and HtmStop.

static IEnumerable fHtmCoverCircleXyzfHtmCoverCircleXyz (SqlDouble x, SqlDouble y, SqlDouble z, SqlDouble radiusArcMin)

fHtmCoverCircleXyz(x,y,z,radiusArcMin) returns a trixel table (a list) covering the circle centered at that x,y,z, within that arc-minute radius. A trixel table is a list of HtmIDStart,HtmIDEnd pairs that describe the HTM triangles (all points of a triangle are between its HtmIDStart and HtmIDEnd.

static IEnumerable fHtmCoverListfHtmCoverList (SqlString coverspec)

fHtmCoverList(regionspec) returns a list of HtmID's that describe the HTM triangles covering the region.

static IEnumerable fHtmCoverRegionSelectfHtmCoverRegionSelect (SqlString coverspec, SqlString kind)

fHtmCoverRegionSelect(regionspec) returns a the qualified list of HtmIDStart,HtmIDEnd pairs that describe the level 20 trixels covering the region.

static IEnumerable fHtmCoverRegionfHtmCoverRegion (SqlString coverspec)

static IEnumerable fHtmCoverTypedRegionfHtmCoverTypedRegion (SqlString coverspec)

fHtmCoverTypedRegion(region) returns a list of HtmStart,HtmStop pairs that describe the HTM triangles covering the region. Full and Partial triangles. are treated separately.

static IEnumerable fHtmRegionToTablefHtmRegionToTable (SqlString coverspec)

fHtmRegionToTable(region) converts a region definiton a table of halfspaces

static SqlString fHtmRegionToNormalFormStringfHtmRegionToNormalFormString (SqlString coverspec)

fHtmRegionToNormalFormString(coverspec) converts a region definiton to normal form

static SqlString fHtmRegionErrorfHtmRegionError (SqlString coverspec)

fHtmRegionError(coverspec) returns diagnostic message appropriate for a bad region string

ClassesClasses

class AugPairAugPair

AugPair is a pair of HtmID's with a flag. It defines the format of IEnumerable list elements returned by the htm cover functions that treat partial and full separately These lists are recast as tables of the form T(HTM_start bigint, HTM_end bigint, full bool) where full = true means range consists offull trixels, else partial.

class DPairDPair

DPair is a pair of doubles It defines the format of IEnumerable list elements returned by the ..ToLatLon functions. These lists are recast as tables of the form T(ra float, dec float) as well as lat and lon.

class HSEntryHSEntry

HSentry is a halfspace entry in a row: convexID halfspaceID x y z D.

class PairPair

Pair is a pair of HtmID pair. It defines the format of IEnumerable list elements returned by the htm cover functions. These lists are recast as tables of the form T(HTM_start bigint, HTM_end bigint).

class ScalarScalar

Scalar is a 1-tuple of HtmID. It defines the format of IEnumerable list elements returned by the htm cover list function. These lists are recast as tables of the form T(HTM_id bigint).

class TripleTriple

Triple is a is an X, Y, Z vector in Cartesian space. It defines the format of IEnumerable list elements returned by the htmToVerticies function. These lists are recast a a table of the form T(x float, y float, z float).

Detailed DescriptionDetailed Description

Encapsulates the HTM procedures for use from SQL2005.

Member Function DocumentationMember Function Documentation

static SqlString Spherical.Htm.Sql.fHtmVersionstatic SqlString Spherical.Htm.Sql.fHtmVersion (( ) ) [static]

fHtmVersion()fHtmVersion() returns the version number of this htm library as a string

Returns:Returns:

sqlString: a string telling the version number.

Typically: "Spherical.HTM 3.1.0 (Release - Build 1)"

create function fHtmVersion() returns nvarchar(max)

as external name HTM.Sql.fHtmVersion

declare @version nvarchar(max)

select @version = dbo.fHtmVersion()

static long Spherical.Htm.Sql.fHtmXyzstatic long Spherical.Htm.Sql.fHtmXyz (( double double xx,,

double double yy,,

double double zz

)) [static]

fHtmXyz(x,y,z) returns the 20-deep HtmID of the given cartesian point.

There are no error cases. All vectors are nomalized and 0,0,0 maps to 1,0,0

Parameters:Parameters:

x double, x Cartesian coordinate

y double, y Cartesian coordinate

z double, z Cartesian coordinate

Returns:Returns:

HtmID: Int64 20-deep HTM id of the point

create function fHtmXyz(@x float, @y float, @z float)

returns bigint

as external name HTM.Sql.fHtmXyz

declare @HtmID bigint

select @HtmID = dbo.fHtmXyz(1,0,0)

See also:See also:

fHtmEq()fHtmEq()

uses eqatorial.

static long Spherical.Htm.Sql.fHtmEqstatic long Spherical.Htm.Sql.fHtmEq (( double double rara,,

double double decdec

)) [static]

fHtmEq(ra,dec) returns the 20-deep HtmID of the given equatorial point.

There are no error cases. all RA, folded to [0..360] and dec to [-90...90]

Parameters:Parameters:

ra double, right ascencion coordinate (degrees)

dec double, declination coordinate (degrees)

Returns:Returns:

HtmID: Int64 20-deep HTM id of the point

create function fHtmEq(@ra float, @dec float )

returns bigint

as external name HTM.Sql.fHtmEq

declare @HtmID bigint

select @HtmID = dbo.fHtmEq(195,5) --

See also:See also:

fHtmXyz()fHtmXyz()

uses cartesian.

static long Spherical.Htm.Sql.fHtmLatLonstatic long Spherical.Htm.Sql.fHtmLatLon (( double double latlat,,

double double lonlon

)) [static]

fHtm(lat,lon) returns the 20-deep HtmID of the given location.

There are no error cases. all RA, folded to [0..360] and dec to [0...90]

Parameters:Parameters:

lat double, latitude coordinate (degrees)

lon double, longitude coordinate (degrees)

Returns:Returns:

HtmID: Int64 20-deep HTM id of the point

create function fHtmLatLon(@lat float, @lon float )

returns bigint

as external name HTM.Sql.fHtmLatLon

declare @HtmID bigint

select @HtmID = dbo.fHtmLatLon(5, 195) -- output defaults to ''

See also:See also:

fHtmXyz()fHtmXyz()

uses cartesian.

See also:See also:

fHtmEq()fHtmEq()

uses J2000 (ra/dec).

static SqlDouble Spherical.Htm.Sql.fDistanceEqstatic SqlDouble Spherical.Htm.Sql.fDistanceEq (( double double ra1ra1,,

double double dec1dec1,,

double double ra2ra2,,

double double dec2dec2

)) [static]

double fDistanceEq(ra1,dec1,ra2,dec2) returns distance in ArcMinutes between two points.

Parameters:Parameters:

ra1 double, right ascencion coordinate (degrees)

dec1 double, declination coordinate (degrees)

ra2 double, right ascencion coordinate (degrees)

dec2 double, declination coordinate (degrees)

Returns:Returns:

double distance in arc minutes.

create function fDistanceEq(@ra1 float, @dec1 float, @ra2 float, @dec2 float)

returns float

as external name HTM.Sql.fDistanceEq

select dbo.fDistanceEq(0,0,30,30)

--------------------------------------------------------------

static SqlDouble Spherical.Htm.Sql.fDistanceLatLonstatic SqlDouble Spherical.Htm.Sql.fDistanceLatLon (( double double lat1lat1,,

double double lon1lon1,,

double double lat2lat2,,

double double lon2lon2

)) [static]

double fDistanceLatLon(lat1,lon1,lat2,lon2) returns distance in ArcMinutes between two points.

Parameters:Parameters:

lat1 double, latitude coordinate (degrees)

lon1 double, longitude coordinate (degrees)

lat2 double, latitude coordinate (degrees)

lon2 double, longitude coordinate (degrees)

Returns:Returns:

double distance in arc minutes.

create function fDistanceLatLon(@lat1 float, @lon1 float, @lat2 float, @lon2 float)

returns float

as external name HTM.Sql.fDistanceLatLon

select dbo.fDistanceLatLon(0,0,30,30)

--------------------------------------------------------------

static SqlDouble Spherical.Htm.Sql.fDistanceXyzstatic SqlDouble Spherical.Htm.Sql.fDistanceXyz (( double double x1x1,,

double double y1y1,,

double double z1z1,,

double double x2x2,,

double double y2y2,,

double double z2z2

)) [static]

double fDistanceXyz(x1,y1,z1,x2,y2,z2) returns distance in ArcMinutes between two points.

Parameters:Parameters:

x1 double, first x Cartesian coordinate

y1 double, first y Cartesian coordinate

z1 double, first z Cartesian coordinate

x2 double, second x Cartesian coordinate

y2 double, second y Cartesian coordinate

z2 double, second z Cartesian coordinate

Returns:Returns:

double distance in arc minutes.

create function fDistanceXyz(@x1 float, @y1 float, @z1 float,

@x2 float, @y2 float, @z2 float)

returns float

as external name HTM.Sql.fDistanceXyz

select dbo.fDistanceEq(0,0,0,0,0,1)

--------------------------------------------------------------

static SqlString Spherical.Htm.Sql.fHtmToStringstatic SqlString Spherical.Htm.Sql.fHtmToString (( SqlInt64 SqlInt64 HtmIDHtmID ) ) [static]

fHtmToString(HtmID) returns varchar(max)a string describing the HtmID

Parameters:Parameters:

HtmID the ID to be translated

Returns:Returns:

varchar(max)

create function fHtmToString(HtmID)

returns varchar(max)

as external name HTM.Sql.fHtmToString

print dbo.fHtmToString(dbo.fHtmXyz(1,0,0))

static IEnumerable Spherical.Htm.Sql.fHtmLatLonToXyzstatic IEnumerable Spherical.Htm.Sql.fHtmLatLonToXyz (( SqlDouble SqlDouble latlat,,

SqlDouble SqlDouble lonlon

)) [static]

XyzTable(x,y,z) fHtmLatLonToXyz(lat, lon) converts an lat,lon point to a table with one row containing the cartesian point (x,y,z).

Parameters:Parameters:

lat double, latitude coordinate (degrees)

lon double, longitude coordinate (degrees)

Returns:Returns:

IEnummerable VertexTable(x float, y float, z float)

with a row contining the (x,y,z) of a lat,lon point.

create function fHtmLatLonToXyz(lat float, lon float)

returns VertexTable(x float, y float, z float)

as external name HTM.Sql.fHtmLatLonToXyz

select * from fHtmLatLonToXyz(115, 38)

See also:See also:

fHtmXyzToLatLon()fHtmXyzToLatLon()

converts xyz to lat,lon.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmEqToXyzstatic IEnumerable Spherical.Htm.Sql.fHtmEqToXyz (( SqlDouble SqlDouble rara,,

SqlDouble SqlDouble decdec

)) [static]

XyzTable(x,y,z) fHtmEqToXyz(ra, dec) converts an equitorial point to a table with one row containing the cartesian point (x,y,z).

Parameters:Parameters:

ra double, right ascencion coordinate (degrees)

dec double, declination coordinate (degrees)

Returns:Returns:

IEnummerable VertexTable(x float, y float, z float)

with a row contining the (x,y,z) of a ra,dec point.

create function fHtmEqXyz(lat float, lon float)

returns VertexTable(x float, y float, z float)

as external name HTM.Sql.fHtmEqToXyz

select * from fHtmEqToXyz(115, 38)

See also:See also:

fHtmXyzToEq()fHtmXyzToEq()

converts xyz to ra, dec.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmXyzToLatLonstatic IEnumerable Spherical.Htm.Sql.fHtmXyzToLatLon (( SqlDouble SqlDouble xx,,

SqlDouble SqlDouble yy,,

SqlDouble SqlDouble zz

)) [static]

LatLonTable(lat,lon) fHtmXyzToLatLon(x,y,z) converts the cartesian point (x,y,z) to a table with one row containing the equivalent lat,lon

point.

Parameters:Parameters:

x double, unit vector cartesian "x"

y double, unit vector cartesian "x"

z double, unit vector cartesian "x"

Returns:Returns:

IEnummerable LatLonTable(lat float, lon float)

with a row contining the (lat, lon) of the cartesian xyz point.

create function fHtmXyzToEq(x float, y float, z float)

returns LatLonTable(lat float, lon float)

as external name HTM.Sql.fHtmXyzToLatLon

select * from fHtmXyzToLatLon(1,0,0)

See also:See also:

fHtmLatLonToXyz()fHtmLatLonToXyz()

converts lat, lon to xyz.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmXyzToEqstatic IEnumerable Spherical.Htm.Sql.fHtmXyzToEq (( SqlDouble SqlDouble xx,,

SqlDouble SqlDouble yy,,

SqlDouble SqlDouble zz

)) [static]

EqTable(ra, dec) fHtmXyzToEq(x,y,z) converts the cartesian point (x,y,z) to a table with one row containing the equivalent equitorial (ra,dec)

point.

Parameters:Parameters:

x double, unit vector cartesian "x"

y double, unit vector cartesian "x"

z double, unit vector cartesian "x"

Returns:Returns:

IEnummerable EqTable(ra float, dec float)

with a row contining the (ra, dec) of the cartesian xyz point.

create function fHtmXyzToEq(x float, y float, z float)

returns EqTable(ra float, dec float)

as external name HTM.Sql.fHtmXyzToEq

select * from fHtmXyzToEq(1,0,0)

See also:See also:

fHtmEqToXyz()fHtmEqToXyz()

converts ra, dec to xyz.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmToCenterPointstatic IEnumerable Spherical.Htm.Sql.fHtmToCenterPoint (( SqlInt64 SqlInt64 HtmIDHtmID ) ) [static]

fHtmToCenterPoint(HtmID) converts an HTM triangle ID to an (x,y,z) vector of the HTM triangle centerpoint.

and returns that vector as the only row of a table.

Parameters:Parameters:

HtmID long: the htm ID of the triangle. an unsigned bigint.

Returns:Returns:

IEnummerable VertexTable(x float, y float, z float)

with one row contining the HTM triangle centerpoint.

create function fHtmToCenterPoint(@htmID bigint.)

returns VertexTable(x float, y float, z float)

as external name HTM.Sql.fHtmToCenterPoint

select * from fHtmToCenterPoint(dbo.fHtmXyz(.57735,.57735,.57735))

<br> gives: 0.577350269189626, 0.577350269189626, 0.577350269189626

See also:See also:

fHtmToCornerPoints()fHtmToCornerPoints()

gives triangle corner points.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmToCornerPointsstatic IEnumerable Spherical.Htm.Sql.fHtmToCornerPoints (( SqlInt64 SqlInt64 HtmIDHtmID ) ) [static]

fHtmToCornerPoints(HtmID) converts an HTM triangle ID to an table of three (x,y,z) vectors of the HTM triangle corners.

Parameters:Parameters:

HtmID long: the htm ID of the triangle. an unsigned bigint.

Returns:Returns:

IEnummerable VertexTable(x float, y float, z float)

with each row contining the (x,y,z) of a triangle corner point.

create function fHtmTovertices(@htmID bigint.)

returns VertexTable(x float, y float, z float)

as external name HTM.Sql.fHtmTovertices

select * from fHtmToCornerPoints(8)

gives: x y z

1 0 0

0 0 -1

0 1 0

See also:See also:

fHtmToCenterPoint()fHtmToCenterPoint()

gives triangle center point.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverCircleLatLonstatic IEnumerable Spherical.Htm.Sql.fHtmCoverCircleLatLon (( SqlDouble SqlDouble latlat,,

SqlDouble SqlDouble lonlon,,

SqlDouble SqlDouble radiusArcMinradiusArcMin

)) [static]

fHtmCoverCircleLatLon(ra,dec,radiusArcMin) returns a trixel table (a list) covering

the circle centered at that lat,lon, within that arc-minute radius.

A trixel table is a list of HtmIDStart,HtmIDEnd pairs that describe

the HTM triangles (all points of a triangle are between its HtmIDStart and HtmIDEnd.

Parameters:Parameters:

lat double, latitude of centerpoint (degrees)

lon double, longitude of centerpoint (degrees)

radiusArcMin double, radius in arcminutes

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDend bigint)

create function fHtmCoverCircleLatLon(@lat float, @lon float, @radiusArcMin float)

returns bigint

as external name HTM.Sql.fHtmCoverCircleLatLon

select * from fHtmCoverCircLatLon(5,195,1)

See also:See also:

fHtmCoverCircleXyz()fHtmCoverCircleXyz()

uses cartesian.

See also:See also:

fHtmCoverCircleEq()fHtmCoverCircleEq()

uses J2000.

See also:See also:

fHtmCover()

uses string definition.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverCircleEqstatic IEnumerable Spherical.Htm.Sql.fHtmCoverCircleEq (( SqlDouble SqlDouble rara,,

SqlDouble SqlDouble decdec,,

SqlDouble SqlDouble radiusArcMinradiusArcMin

)) [static]

fHtmCoverCircleEq(ra,dec,radiusArcMin) returns a trixel table (a list) covering

the circle centered at that J2000 ra,dec, within that arc-minute radius.

A trixel table is a list of HtmStart,HtmStop pairs that describe

the HTM triangles (all points of a triangle are between its HtmStart and HtmStop.

Parameters:Parameters:

ra double, right ascencion of centerpoint (degrees)

dec double, declination of centerpoint (degrees)

radiusArcMin double, radius in arcminutes

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDStop bigint)

create function fHtmCoverCircleEq(@ra float, @dec float, @radiusArcMin float)

returns bigint

as external name HTM.Sql.fHtmCoverCircleEq

See also:See also:

fHtmCoverCircleXyz()fHtmCoverCircleXyz()

uses cartesian.

See also:See also:

fHtmCover()

uses string definition.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverCircleXyzstatic IEnumerable Spherical.Htm.Sql.fHtmCoverCircleXyz (( SqlDouble SqlDouble xx,,

SqlDouble SqlDouble yy,,

SqlDouble SqlDouble zz,,

SqlDouble SqlDouble radiusArcMinradiusArcMin

)) [static]

fHtmCoverCircleXyz(x,y,z,radiusArcMin) returns a trixel table (a list) covering

the circle centered at that x,y,z, within that arc-minute radius.

A trixel table is a list of HtmIDStart,HtmIDEnd pairs that describe

the HTM triangles (all points of a triangle are between its HtmIDStart and HtmIDEnd.

Parameters:Parameters:

x double, x Cartesian coordinate of centerpoint

y double, y Cartesian coordinate of centerpoint

z double, z Cartesian coordinate of centerpoint

radiusArcMin double, radius in arcminutes

Returns:Returns:

IEnummerable TrixelTable(HtmIDStart bigint, HtmIDend bigint)

create function fHtmCoverCircleXyz(@x float, @y float, @z float, @radiusArcMin float)

returns bigint

as external name HTM.Sql.fHtmCoverCircleXyz

declare @HtmID bigint

select * from fHtmCoverCircleXyz(1,0,0,1)

See also:See also:

fHtmCoverCircleEq()fHtmCoverCircleEq()

uses J2000.

See also:See also:

fHtmCover()

uses string definition.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverListstatic IEnumerable Spherical.Htm.Sql.fHtmCoverList (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmCoverList(regionspec) returns a list of HtmID's that describe the HTM triangles covering the region.

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

IEnummerable(HtmID bigint)

create function fHtmCoverList(@region nvarchar(max))

returns table (HtmID bigint)

as external name HTM.Sql.fHtmCoverList

select * from fHtmCoverList('CIRCLE J2000 195 0 1')

See also:See also:

fHtmCoverRegion()fHtmCoverRegion()

gives table of HtmID ranges.

See also:See also:

fHtmCoverError()

gives diagnostic message.

See also:See also:

fHtmCircleEq()

Equatorial circle.

See also:See also:

fHtmCircleXyz()

Cartesian circle.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverRegionSelectstatic IEnumerable Spherical.Htm.Sql.fHtmCoverRegionSelect (( SqlString SqlString coverspeccoverspec,,

SqlString SqlString kindkind

)) [static]

fHtmCoverRegionSelect(regionspec) returns a the qualified list of HtmIDStart,HtmIDEnd pairs

that describe the level 20 trixels covering the region.

Parameters:Parameters:

coverspec a string satisfying the region syntax

kind "Partial", "Full" or "Both"

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDend bigint)

create function fHtmCoverRegionSelect(@region nvarchar(max), @kind nvarchar(max))

returns table (HtmIDstart bigint, HtmIDend bigint)

as external name HTM.Sql.fHtmCoverRegionSelect

select * from fHtmCoverRegionSelect('CIRCLE J2000 195 0 1', 'full')

See also:See also:

fHtmCoverError()

gives diagnostic message.

See also:See also:

fHtmCircleEq()

Equatorial circle.

See also:See also:

fHtmCircleXyz()

Cartesian circle.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverRegionstatic IEnumerable Spherical.Htm.Sql.fHtmCoverRegion (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmCoverRegion(region) returns a list of HtmStart,HtmStop pairs

that describe the HTM triangles covering the region.

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDend bigint)

create function fHtmCoverRegion(@region nvarchar(max))

returns table (HtmIDstart bigint, HtmIDend bigint)

as external name HTM.Sql.fHtmCover

select * from fHtmCoverRegion('CIRCLE J2000 195 0 1')

See also:See also:

fHtmCoverError()

gives diagnostic message.

See also:See also:

fHtmCircleEq()

Equatorial circle.

See also:See also:

fHtmCircleXyz()

Cartesian circle.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverTypedRegionstatic IEnumerable Spherical.Htm.Sql.fHtmCoverTypedRegion (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmCoverTypedRegion(region) returns a list of HtmStart,HtmStop pairs

that describe the HTM triangles covering the region. Full and Partial triangles. are treated separately.

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDend bigint, flag smallint)

create function fHtmCoverTypedRegion(@region nvarchar(max))

returns table (HtmIDstart bigint, HtmIDend bigint, flag smallint)

as external name HTM.Sql.fHtmCover

select * from fHtmCoverTypedRegion('CIRCLE J2000 195 0 1')

See also:See also:

fHtmCoverRegion()fHtmCoverRegion()

gives diagnostic message.

See also:See also:

fHtmCoverError()

gives diagnostic message.

See also:See also:

fHtmCircleEq()

Equatorial circle.

See also:See also:

fHtmCircleXyz()

Cartesian circle.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmRegionToTablestatic IEnumerable Spherical.Htm.Sql.fHtmRegionToTable (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmRegionToTable(region) converts a region definiton a table of halfspaces

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

Table of Halfspaces:

This looks something like REGION CONVEX 1 0 0 0 0 1 0 0 CONVEX 0 0 1 0

create function fHtmRegionToTable(@region nvarchar(max))

returns table (convexid int, halfspaceid int, x double, y double, z double, D double)

as external name HTM.Sql.fHtmRegionToTable

select * from dbo.fHtmRegionToTable('CIRCLE J2000 195 0 1')

--------------------------------------------------------------

static SqlString Spherical.Htm.Sql.fHtmRegionToNormalFormStringstatic SqlString Spherical.Htm.Sql.fHtmRegionToNormalFormString (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmRegionToNormalFormString(coverspec) converts a region definiton to normal form

Parameters:Parameters:

coverspec a string satisfying the region syntax

regionSpec := REGION {areaSpec}* | areaSpec

circleSpec := CIRCLE J2000 ra dec radArcMin

| CIRCLE LATLON lat lon radArcMin

| CIRCLE [CARTESIAN ] x y z radArcMin

rectSpec := RECT LATLON {lat lon}2

| RECT J2000 {ra dec }2

| RECT [CARTESIAN ] {x y z }2

polySpec := POLY LATLON {lat lon}3+

| POLY J2000 {ra dec }3+

| POLY [CARTESIAN ] {x y z }3+

hullSpec := CHULL LATLON {lat lon}3+

| CHULL J2000 {ra dec }3+

| CHULL [CARTESIAN ] {x y z }3+

convexSpec := CONVEX LATLON {lat lon}*

| CONVEX J2000 {ra dec }*

| CONVEX [CARTESIAN ]{x y z }*

areaSpec := circleSpec | rectSpec | polySpec | hullSpec | convexSpec

Returns:Returns:

region String SqlString region in normal form ( a union of convexes)

This looks something like 'REGION CONVEX 1 0 0 0 0 1 0 0 CONVEX 0 0 1 0'

create function fHtmRegionToNormalFormString(@region nvarchar(max))

returns table (HtmID_start bigint, HtmID_end bigint)

as external name HTM.Sql.fHtmToNormalForm

select dbo.fHtmRegionToNormalFormString('CIRCLE J2000 195 0 1')

--------------------------------------------------------------

static SqlString Spherical.Htm.Sql.fHtmRegionErrorstatic SqlString Spherical.Htm.Sql.fHtmRegionError (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmRegionError(coverspec) returns diagnostic message appropriate for a bad region string

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

diagnostic message: varchar(max)

OK if ok

else message and a syntax string.

create function fHtmRegionError(@region nvarchar(max))

returns varchar(max)

as external name HTM.Sql.fHtmRegionError

print dbo.fHtmRegionError('CIRCLE LATLON 195 ')

See also:See also:

fHtmCover()

the main routine

--------------------------------------------------------------

The documentation for this class was generated from the following file:

Sql.cs

May 27, 2007 György Fekete V 3.1.2

Page 54: VO Course 11: Spatial indexing

HTM SQL API

Main PageMain Page ClassesClasses

Class ListClass List Class MembersClass Members

SphericalSpherical.HtmHtm.SqlSql

Spherical.Htm.Sql Class ReferenceSpherical.Htm.Sql Class Reference

Encapsulates the HTM procedures for use from SQL2005. More...

List of all members.

Static Public Member FunctionsStatic Public Member Functions

static SqlString fHtmVersionfHtmVersion ()

fHtmVersion()fHtmVersion() returns the version number of this htm library as a string

static long fHtmXyzfHtmXyz (double x, double y, double z)

fHtmXyz(x,y,z) returns the 20-deep HtmID of the given cartesian point. There are no error cases. All vectors are nomalized and 0,0,0 maps to 1,0,0

static long fHtmEqfHtmEq (double ra, double dec)

fHtmEq(ra,dec) returns the 20-deep HtmID of the given equatorial point. There are no error cases. all RA, folded to [0..360] and dec to [-90...90]

static long fHtmLatLonfHtmLatLon (double lat, double lon)

fHtm(lat,lon) returns the 20-deep HtmID of the given location. There are no error cases. all RA, folded to [0..360] and dec to [0...90]

static SqlDouble fDistanceEqfDistanceEq (double ra1, double dec1, double ra2, double dec2)

double fDistanceEq(ra1,dec1,ra2,dec2) returns distance in ArcMinutes between two points.

static SqlDouble fDistanceLatLonfDistanceLatLon (double lat1, double lon1, double lat2, double lon2)

double fDistanceLatLon(lat1,lon1,lat2,lon2) returns distance in ArcMinutes between two points.

static SqlDouble fDistanceXyzfDistanceXyz (double x1, double y1, double z1, double x2, double y2, double z2)

double fDistanceXyz(x1,y1,z1,x2,y2,z2) returns distance in ArcMinutes between two points.

static SqlString fHtmToStringfHtmToString (SqlInt64 HtmID)

fHtmToString(HtmID) returns varchar(max)a string describing the HtmID

static IEnumerable fHtmLatLonToXyzfHtmLatLonToXyz (SqlDouble lat, SqlDouble lon)

XyzTable(x,y,z) fHtmLatLonToXyz(lat, lon) converts an lat,lon point to a table with one row containing the cartesian point (x,y,z).

static IEnumerable fHtmEqToXyzfHtmEqToXyz (SqlDouble ra, SqlDouble dec)

XyzTable(x,y,z) fHtmEqToXyz(ra, dec) converts an equitorial point to a table with one row containing the cartesian point (x,y,z).

static IEnumerable fHtmXyzToLatLonfHtmXyzToLatLon (SqlDouble x, SqlDouble y, SqlDouble z)

LatLonTable(lat,lon) fHtmXyzToLatLon(x,y,z) converts the cartesian point (x,y,z) to a table with one row containing the equivalentlat,lon point.

static IEnumerable fHtmXyzToEqfHtmXyzToEq (SqlDouble x, SqlDouble y, SqlDouble z)

EqTable(ra, dec) fHtmXyzToEq(x,y,z) converts the cartesian point (x,y,z) to a table with one row containing the equivalent equitorial(ra,dec) point.

static IEnumerable fHtmToCenterPointfHtmToCenterPoint (SqlInt64 HtmID)

fHtmToCenterPoint(HtmID) converts an HTM triangle ID to an (x,y,z) vector of the HTM triangle centerpoint. and returns that vector as the only row of a table.

static IEnumerable fHtmToCornerPointsfHtmToCornerPoints (SqlInt64 HtmID)

fHtmToCornerPoints(HtmID) converts an HTM triangle ID to an table of three (x,y,z) vectors of the HTM triangle corners.

static IEnumerable fHtmCoverCircleLatLonfHtmCoverCircleLatLon (SqlDouble lat, SqlDouble lon, SqlDouble radiusArcMin)

fHtmCoverCircleLatLon(ra,dec,radiusArcMin) returns a trixel table (a list) covering the circle centered at that lat,lon, within that arc-minute radius. A trixel table is a list of HtmIDStart,HtmIDEnd pairs that describe the HTM triangles (all points of a triangle are between its HtmIDStart and HtmIDEnd.

static IEnumerable fHtmCoverCircleEqfHtmCoverCircleEq (SqlDouble ra, SqlDouble dec, SqlDouble radiusArcMin)

fHtmCoverCircleEq(ra,dec,radiusArcMin) returns a trixel table (a list) covering the circle centered at that J2000 ra,dec, within that arc-minute radius. A trixel table is a list of HtmStart,HtmStop pairs that describe the HTM triangles (all points of a triangle are between its HtmStart and HtmStop.

static IEnumerable fHtmCoverCircleXyzfHtmCoverCircleXyz (SqlDouble x, SqlDouble y, SqlDouble z, SqlDouble radiusArcMin)

fHtmCoverCircleXyz(x,y,z,radiusArcMin) returns a trixel table (a list) covering the circle centered at that x,y,z, within that arc-minute radius. A trixel table is a list of HtmIDStart,HtmIDEnd pairs that describe the HTM triangles (all points of a triangle are between its HtmIDStart and HtmIDEnd.

static IEnumerable fHtmCoverListfHtmCoverList (SqlString coverspec)

fHtmCoverList(regionspec) returns a list of HtmID's that describe the HTM triangles covering the region.

static IEnumerable fHtmCoverRegionSelectfHtmCoverRegionSelect (SqlString coverspec, SqlString kind)

fHtmCoverRegionSelect(regionspec) returns a the qualified list of HtmIDStart,HtmIDEnd pairs that describe the level 20 trixels covering the region.

static IEnumerable fHtmCoverRegionfHtmCoverRegion (SqlString coverspec)

static IEnumerable fHtmCoverTypedRegionfHtmCoverTypedRegion (SqlString coverspec)

fHtmCoverTypedRegion(region) returns a list of HtmStart,HtmStop pairs that describe the HTM triangles covering the region. Full and Partial triangles. are treated separately.

static IEnumerable fHtmRegionToTablefHtmRegionToTable (SqlString coverspec)

fHtmRegionToTable(region) converts a region definiton a table of halfspaces

static SqlString fHtmRegionToNormalFormStringfHtmRegionToNormalFormString (SqlString coverspec)

fHtmRegionToNormalFormString(coverspec) converts a region definiton to normal form

static SqlString fHtmRegionErrorfHtmRegionError (SqlString coverspec)

fHtmRegionError(coverspec) returns diagnostic message appropriate for a bad region string

ClassesClasses

class AugPairAugPair

AugPair is a pair of HtmID's with a flag. It defines the format of IEnumerable list elements returned by the htm cover functions that treat partial and full separately These lists are recast as tables of the form T(HTM_start bigint, HTM_end bigint, full bool) where full = true means range consists offull trixels, else partial.

class DPairDPair

DPair is a pair of doubles It defines the format of IEnumerable list elements returned by the ..ToLatLon functions. These lists are recast as tables of the form T(ra float, dec float) as well as lat and lon.

class HSEntryHSEntry

HSentry is a halfspace entry in a row: convexID halfspaceID x y z D.

class PairPair

Pair is a pair of HtmID pair. It defines the format of IEnumerable list elements returned by the htm cover functions. These lists are recast as tables of the form T(HTM_start bigint, HTM_end bigint).

class ScalarScalar

Scalar is a 1-tuple of HtmID. It defines the format of IEnumerable list elements returned by the htm cover list function. These lists are recast as tables of the form T(HTM_id bigint).

class TripleTriple

Triple is a is an X, Y, Z vector in Cartesian space. It defines the format of IEnumerable list elements returned by the htmToVerticies function. These lists are recast a a table of the form T(x float, y float, z float).

Detailed DescriptionDetailed Description

Encapsulates the HTM procedures for use from SQL2005.

Member Function DocumentationMember Function Documentation

static SqlString Spherical.Htm.Sql.fHtmVersionstatic SqlString Spherical.Htm.Sql.fHtmVersion (( ) ) [static]

fHtmVersion()fHtmVersion() returns the version number of this htm library as a string

Returns:Returns:

sqlString: a string telling the version number.

Typically: "Spherical.HTM 3.1.0 (Release - Build 1)"

create function fHtmVersion() returns nvarchar(max)

as external name HTM.Sql.fHtmVersion

declare @version nvarchar(max)

select @version = dbo.fHtmVersion()

static long Spherical.Htm.Sql.fHtmXyzstatic long Spherical.Htm.Sql.fHtmXyz (( double double xx,,

double double yy,,

double double zz

)) [static]

fHtmXyz(x,y,z) returns the 20-deep HtmID of the given cartesian point.

There are no error cases. All vectors are nomalized and 0,0,0 maps to 1,0,0

Parameters:Parameters:

x double, x Cartesian coordinate

y double, y Cartesian coordinate

z double, z Cartesian coordinate

Returns:Returns:

HtmID: Int64 20-deep HTM id of the point

create function fHtmXyz(@x float, @y float, @z float)

returns bigint

as external name HTM.Sql.fHtmXyz

declare @HtmID bigint

select @HtmID = dbo.fHtmXyz(1,0,0)

See also:See also:

fHtmEq()fHtmEq()

uses eqatorial.

static long Spherical.Htm.Sql.fHtmEqstatic long Spherical.Htm.Sql.fHtmEq (( double double rara,,

double double decdec

)) [static]

fHtmEq(ra,dec) returns the 20-deep HtmID of the given equatorial point.

There are no error cases. all RA, folded to [0..360] and dec to [-90...90]

Parameters:Parameters:

ra double, right ascencion coordinate (degrees)

dec double, declination coordinate (degrees)

Returns:Returns:

HtmID: Int64 20-deep HTM id of the point

create function fHtmEq(@ra float, @dec float )

returns bigint

as external name HTM.Sql.fHtmEq

declare @HtmID bigint

select @HtmID = dbo.fHtmEq(195,5) --

See also:See also:

fHtmXyz()fHtmXyz()

uses cartesian.

static long Spherical.Htm.Sql.fHtmLatLonstatic long Spherical.Htm.Sql.fHtmLatLon (( double double latlat,,

double double lonlon

)) [static]

fHtm(lat,lon) returns the 20-deep HtmID of the given location.

There are no error cases. all RA, folded to [0..360] and dec to [0...90]

Parameters:Parameters:

lat double, latitude coordinate (degrees)

lon double, longitude coordinate (degrees)

Returns:Returns:

HtmID: Int64 20-deep HTM id of the point

create function fHtmLatLon(@lat float, @lon float )

returns bigint

as external name HTM.Sql.fHtmLatLon

declare @HtmID bigint

select @HtmID = dbo.fHtmLatLon(5, 195) -- output defaults to ''

See also:See also:

fHtmXyz()fHtmXyz()

uses cartesian.

See also:See also:

fHtmEq()fHtmEq()

uses J2000 (ra/dec).

static SqlDouble Spherical.Htm.Sql.fDistanceEqstatic SqlDouble Spherical.Htm.Sql.fDistanceEq (( double double ra1ra1,,

double double dec1dec1,,

double double ra2ra2,,

double double dec2dec2

)) [static]

double fDistanceEq(ra1,dec1,ra2,dec2) returns distance in ArcMinutes between two points.

Parameters:Parameters:

ra1 double, right ascencion coordinate (degrees)

dec1 double, declination coordinate (degrees)

ra2 double, right ascencion coordinate (degrees)

dec2 double, declination coordinate (degrees)

Returns:Returns:

double distance in arc minutes.

create function fDistanceEq(@ra1 float, @dec1 float, @ra2 float, @dec2 float)

returns float

as external name HTM.Sql.fDistanceEq

select dbo.fDistanceEq(0,0,30,30)

--------------------------------------------------------------

static SqlDouble Spherical.Htm.Sql.fDistanceLatLonstatic SqlDouble Spherical.Htm.Sql.fDistanceLatLon (( double double lat1lat1,,

double double lon1lon1,,

double double lat2lat2,,

double double lon2lon2

)) [static]

double fDistanceLatLon(lat1,lon1,lat2,lon2) returns distance in ArcMinutes between two points.

Parameters:Parameters:

lat1 double, latitude coordinate (degrees)

lon1 double, longitude coordinate (degrees)

lat2 double, latitude coordinate (degrees)

lon2 double, longitude coordinate (degrees)

Returns:Returns:

double distance in arc minutes.

create function fDistanceLatLon(@lat1 float, @lon1 float, @lat2 float, @lon2 float)

returns float

as external name HTM.Sql.fDistanceLatLon

select dbo.fDistanceLatLon(0,0,30,30)

--------------------------------------------------------------

static SqlDouble Spherical.Htm.Sql.fDistanceXyzstatic SqlDouble Spherical.Htm.Sql.fDistanceXyz (( double double x1x1,,

double double y1y1,,

double double z1z1,,

double double x2x2,,

double double y2y2,,

double double z2z2

)) [static]

double fDistanceXyz(x1,y1,z1,x2,y2,z2) returns distance in ArcMinutes between two points.

Parameters:Parameters:

x1 double, first x Cartesian coordinate

y1 double, first y Cartesian coordinate

z1 double, first z Cartesian coordinate

x2 double, second x Cartesian coordinate

y2 double, second y Cartesian coordinate

z2 double, second z Cartesian coordinate

Returns:Returns:

double distance in arc minutes.

create function fDistanceXyz(@x1 float, @y1 float, @z1 float,

@x2 float, @y2 float, @z2 float)

returns float

as external name HTM.Sql.fDistanceXyz

select dbo.fDistanceEq(0,0,0,0,0,1)

--------------------------------------------------------------

static SqlString Spherical.Htm.Sql.fHtmToStringstatic SqlString Spherical.Htm.Sql.fHtmToString (( SqlInt64 SqlInt64 HtmIDHtmID ) ) [static]

fHtmToString(HtmID) returns varchar(max)a string describing the HtmID

Parameters:Parameters:

HtmID the ID to be translated

Returns:Returns:

varchar(max)

create function fHtmToString(HtmID)

returns varchar(max)

as external name HTM.Sql.fHtmToString

print dbo.fHtmToString(dbo.fHtmXyz(1,0,0))

static IEnumerable Spherical.Htm.Sql.fHtmLatLonToXyzstatic IEnumerable Spherical.Htm.Sql.fHtmLatLonToXyz (( SqlDouble SqlDouble latlat,,

SqlDouble SqlDouble lonlon

)) [static]

XyzTable(x,y,z) fHtmLatLonToXyz(lat, lon) converts an lat,lon point to a table with one row containing the cartesian point (x,y,z).

Parameters:Parameters:

lat double, latitude coordinate (degrees)

lon double, longitude coordinate (degrees)

Returns:Returns:

IEnummerable VertexTable(x float, y float, z float)

with a row contining the (x,y,z) of a lat,lon point.

create function fHtmLatLonToXyz(lat float, lon float)

returns VertexTable(x float, y float, z float)

as external name HTM.Sql.fHtmLatLonToXyz

select * from fHtmLatLonToXyz(115, 38)

See also:See also:

fHtmXyzToLatLon()fHtmXyzToLatLon()

converts xyz to lat,lon.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmEqToXyzstatic IEnumerable Spherical.Htm.Sql.fHtmEqToXyz (( SqlDouble SqlDouble rara,,

SqlDouble SqlDouble decdec

)) [static]

XyzTable(x,y,z) fHtmEqToXyz(ra, dec) converts an equitorial point to a table with one row containing the cartesian point (x,y,z).

Parameters:Parameters:

ra double, right ascencion coordinate (degrees)

dec double, declination coordinate (degrees)

Returns:Returns:

IEnummerable VertexTable(x float, y float, z float)

with a row contining the (x,y,z) of a ra,dec point.

create function fHtmEqXyz(lat float, lon float)

returns VertexTable(x float, y float, z float)

as external name HTM.Sql.fHtmEqToXyz

select * from fHtmEqToXyz(115, 38)

See also:See also:

fHtmXyzToEq()fHtmXyzToEq()

converts xyz to ra, dec.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmXyzToLatLonstatic IEnumerable Spherical.Htm.Sql.fHtmXyzToLatLon (( SqlDouble SqlDouble xx,,

SqlDouble SqlDouble yy,,

SqlDouble SqlDouble zz

)) [static]

LatLonTable(lat,lon) fHtmXyzToLatLon(x,y,z) converts the cartesian point (x,y,z) to a table with one row containing the equivalent lat,lon

point.

Parameters:Parameters:

x double, unit vector cartesian "x"

y double, unit vector cartesian "x"

z double, unit vector cartesian "x"

Returns:Returns:

IEnummerable LatLonTable(lat float, lon float)

with a row contining the (lat, lon) of the cartesian xyz point.

create function fHtmXyzToEq(x float, y float, z float)

returns LatLonTable(lat float, lon float)

as external name HTM.Sql.fHtmXyzToLatLon

select * from fHtmXyzToLatLon(1,0,0)

See also:See also:

fHtmLatLonToXyz()fHtmLatLonToXyz()

converts lat, lon to xyz.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmXyzToEqstatic IEnumerable Spherical.Htm.Sql.fHtmXyzToEq (( SqlDouble SqlDouble xx,,

SqlDouble SqlDouble yy,,

SqlDouble SqlDouble zz

)) [static]

EqTable(ra, dec) fHtmXyzToEq(x,y,z) converts the cartesian point (x,y,z) to a table with one row containing the equivalent equitorial (ra,dec)

point.

Parameters:Parameters:

x double, unit vector cartesian "x"

y double, unit vector cartesian "x"

z double, unit vector cartesian "x"

Returns:Returns:

IEnummerable EqTable(ra float, dec float)

with a row contining the (ra, dec) of the cartesian xyz point.

create function fHtmXyzToEq(x float, y float, z float)

returns EqTable(ra float, dec float)

as external name HTM.Sql.fHtmXyzToEq

select * from fHtmXyzToEq(1,0,0)

See also:See also:

fHtmEqToXyz()fHtmEqToXyz()

converts ra, dec to xyz.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmToCenterPointstatic IEnumerable Spherical.Htm.Sql.fHtmToCenterPoint (( SqlInt64 SqlInt64 HtmIDHtmID ) ) [static]

fHtmToCenterPoint(HtmID) converts an HTM triangle ID to an (x,y,z) vector of the HTM triangle centerpoint.

and returns that vector as the only row of a table.

Parameters:Parameters:

HtmID long: the htm ID of the triangle. an unsigned bigint.

Returns:Returns:

IEnummerable VertexTable(x float, y float, z float)

with one row contining the HTM triangle centerpoint.

create function fHtmToCenterPoint(@htmID bigint.)

returns VertexTable(x float, y float, z float)

as external name HTM.Sql.fHtmToCenterPoint

select * from fHtmToCenterPoint(dbo.fHtmXyz(.57735,.57735,.57735))

<br> gives: 0.577350269189626, 0.577350269189626, 0.577350269189626

See also:See also:

fHtmToCornerPoints()fHtmToCornerPoints()

gives triangle corner points.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmToCornerPointsstatic IEnumerable Spherical.Htm.Sql.fHtmToCornerPoints (( SqlInt64 SqlInt64 HtmIDHtmID ) ) [static]

fHtmToCornerPoints(HtmID) converts an HTM triangle ID to an table of three (x,y,z) vectors of the HTM triangle corners.

Parameters:Parameters:

HtmID long: the htm ID of the triangle. an unsigned bigint.

Returns:Returns:

IEnummerable VertexTable(x float, y float, z float)

with each row contining the (x,y,z) of a triangle corner point.

create function fHtmTovertices(@htmID bigint.)

returns VertexTable(x float, y float, z float)

as external name HTM.Sql.fHtmTovertices

select * from fHtmToCornerPoints(8)

gives: x y z

1 0 0

0 0 -1

0 1 0

See also:See also:

fHtmToCenterPoint()fHtmToCenterPoint()

gives triangle center point.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverCircleLatLonstatic IEnumerable Spherical.Htm.Sql.fHtmCoverCircleLatLon (( SqlDouble SqlDouble latlat,,

SqlDouble SqlDouble lonlon,,

SqlDouble SqlDouble radiusArcMinradiusArcMin

)) [static]

fHtmCoverCircleLatLon(ra,dec,radiusArcMin) returns a trixel table (a list) covering

the circle centered at that lat,lon, within that arc-minute radius.

A trixel table is a list of HtmIDStart,HtmIDEnd pairs that describe

the HTM triangles (all points of a triangle are between its HtmIDStart and HtmIDEnd.

Parameters:Parameters:

lat double, latitude of centerpoint (degrees)

lon double, longitude of centerpoint (degrees)

radiusArcMin double, radius in arcminutes

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDend bigint)

create function fHtmCoverCircleLatLon(@lat float, @lon float, @radiusArcMin float)

returns bigint

as external name HTM.Sql.fHtmCoverCircleLatLon

select * from fHtmCoverCircLatLon(5,195,1)

See also:See also:

fHtmCoverCircleXyz()fHtmCoverCircleXyz()

uses cartesian.

See also:See also:

fHtmCoverCircleEq()fHtmCoverCircleEq()

uses J2000.

See also:See also:

fHtmCover()

uses string definition.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverCircleEqstatic IEnumerable Spherical.Htm.Sql.fHtmCoverCircleEq (( SqlDouble SqlDouble rara,,

SqlDouble SqlDouble decdec,,

SqlDouble SqlDouble radiusArcMinradiusArcMin

)) [static]

fHtmCoverCircleEq(ra,dec,radiusArcMin) returns a trixel table (a list) covering

the circle centered at that J2000 ra,dec, within that arc-minute radius.

A trixel table is a list of HtmStart,HtmStop pairs that describe

the HTM triangles (all points of a triangle are between its HtmStart and HtmStop.

Parameters:Parameters:

ra double, right ascencion of centerpoint (degrees)

dec double, declination of centerpoint (degrees)

radiusArcMin double, radius in arcminutes

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDStop bigint)

create function fHtmCoverCircleEq(@ra float, @dec float, @radiusArcMin float)

returns bigint

as external name HTM.Sql.fHtmCoverCircleEq

See also:See also:

fHtmCoverCircleXyz()fHtmCoverCircleXyz()

uses cartesian.

See also:See also:

fHtmCover()

uses string definition.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverCircleXyzstatic IEnumerable Spherical.Htm.Sql.fHtmCoverCircleXyz (( SqlDouble SqlDouble xx,,

SqlDouble SqlDouble yy,,

SqlDouble SqlDouble zz,,

SqlDouble SqlDouble radiusArcMinradiusArcMin

)) [static]

fHtmCoverCircleXyz(x,y,z,radiusArcMin) returns a trixel table (a list) covering

the circle centered at that x,y,z, within that arc-minute radius.

A trixel table is a list of HtmIDStart,HtmIDEnd pairs that describe

the HTM triangles (all points of a triangle are between its HtmIDStart and HtmIDEnd.

Parameters:Parameters:

x double, x Cartesian coordinate of centerpoint

y double, y Cartesian coordinate of centerpoint

z double, z Cartesian coordinate of centerpoint

radiusArcMin double, radius in arcminutes

Returns:Returns:

IEnummerable TrixelTable(HtmIDStart bigint, HtmIDend bigint)

create function fHtmCoverCircleXyz(@x float, @y float, @z float, @radiusArcMin float)

returns bigint

as external name HTM.Sql.fHtmCoverCircleXyz

declare @HtmID bigint

select * from fHtmCoverCircleXyz(1,0,0,1)

See also:See also:

fHtmCoverCircleEq()fHtmCoverCircleEq()

uses J2000.

See also:See also:

fHtmCover()

uses string definition.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverListstatic IEnumerable Spherical.Htm.Sql.fHtmCoverList (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmCoverList(regionspec) returns a list of HtmID's that describe the HTM triangles covering the region.

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

IEnummerable(HtmID bigint)

create function fHtmCoverList(@region nvarchar(max))

returns table (HtmID bigint)

as external name HTM.Sql.fHtmCoverList

select * from fHtmCoverList('CIRCLE J2000 195 0 1')

See also:See also:

fHtmCoverRegion()fHtmCoverRegion()

gives table of HtmID ranges.

See also:See also:

fHtmCoverError()

gives diagnostic message.

See also:See also:

fHtmCircleEq()

Equatorial circle.

See also:See also:

fHtmCircleXyz()

Cartesian circle.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverRegionSelectstatic IEnumerable Spherical.Htm.Sql.fHtmCoverRegionSelect (( SqlString SqlString coverspeccoverspec,,

SqlString SqlString kindkind

)) [static]

fHtmCoverRegionSelect(regionspec) returns a the qualified list of HtmIDStart,HtmIDEnd pairs

that describe the level 20 trixels covering the region.

Parameters:Parameters:

coverspec a string satisfying the region syntax

kind "Partial", "Full" or "Both"

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDend bigint)

create function fHtmCoverRegionSelect(@region nvarchar(max), @kind nvarchar(max))

returns table (HtmIDstart bigint, HtmIDend bigint)

as external name HTM.Sql.fHtmCoverRegionSelect

select * from fHtmCoverRegionSelect('CIRCLE J2000 195 0 1', 'full')

See also:See also:

fHtmCoverError()

gives diagnostic message.

See also:See also:

fHtmCircleEq()

Equatorial circle.

See also:See also:

fHtmCircleXyz()

Cartesian circle.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverRegionstatic IEnumerable Spherical.Htm.Sql.fHtmCoverRegion (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmCoverRegion(region) returns a list of HtmStart,HtmStop pairs

that describe the HTM triangles covering the region.

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDend bigint)

create function fHtmCoverRegion(@region nvarchar(max))

returns table (HtmIDstart bigint, HtmIDend bigint)

as external name HTM.Sql.fHtmCover

select * from fHtmCoverRegion('CIRCLE J2000 195 0 1')

See also:See also:

fHtmCoverError()

gives diagnostic message.

See also:See also:

fHtmCircleEq()

Equatorial circle.

See also:See also:

fHtmCircleXyz()

Cartesian circle.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmCoverTypedRegionstatic IEnumerable Spherical.Htm.Sql.fHtmCoverTypedRegion (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmCoverTypedRegion(region) returns a list of HtmStart,HtmStop pairs

that describe the HTM triangles covering the region. Full and Partial triangles. are treated separately.

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

IEnummerable(HtmIDStart bigint, HtmIDend bigint, flag smallint)

create function fHtmCoverTypedRegion(@region nvarchar(max))

returns table (HtmIDstart bigint, HtmIDend bigint, flag smallint)

as external name HTM.Sql.fHtmCover

select * from fHtmCoverTypedRegion('CIRCLE J2000 195 0 1')

See also:See also:

fHtmCoverRegion()fHtmCoverRegion()

gives diagnostic message.

See also:See also:

fHtmCoverError()

gives diagnostic message.

See also:See also:

fHtmCircleEq()

Equatorial circle.

See also:See also:

fHtmCircleXyz()

Cartesian circle.

--------------------------------------------------------------

static IEnumerable Spherical.Htm.Sql.fHtmRegionToTablestatic IEnumerable Spherical.Htm.Sql.fHtmRegionToTable (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmRegionToTable(region) converts a region definiton a table of halfspaces

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

Table of Halfspaces:

This looks something like REGION CONVEX 1 0 0 0 0 1 0 0 CONVEX 0 0 1 0

create function fHtmRegionToTable(@region nvarchar(max))

returns table (convexid int, halfspaceid int, x double, y double, z double, D double)

as external name HTM.Sql.fHtmRegionToTable

select * from dbo.fHtmRegionToTable('CIRCLE J2000 195 0 1')

--------------------------------------------------------------

static SqlString Spherical.Htm.Sql.fHtmRegionToNormalFormStringstatic SqlString Spherical.Htm.Sql.fHtmRegionToNormalFormString (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmRegionToNormalFormString(coverspec) converts a region definiton to normal form

Parameters:Parameters:

coverspec a string satisfying the region syntax

regionSpec := REGION {areaSpec}* | areaSpec

circleSpec := CIRCLE J2000 ra dec radArcMin

| CIRCLE LATLON lat lon radArcMin

| CIRCLE [CARTESIAN ] x y z radArcMin

rectSpec := RECT LATLON {lat lon}2

| RECT J2000 {ra dec }2

| RECT [CARTESIAN ] {x y z }2

polySpec := POLY LATLON {lat lon}3+

| POLY J2000 {ra dec }3+

| POLY [CARTESIAN ] {x y z }3+

hullSpec := CHULL LATLON {lat lon}3+

| CHULL J2000 {ra dec }3+

| CHULL [CARTESIAN ] {x y z }3+

convexSpec := CONVEX LATLON {lat lon}*

| CONVEX J2000 {ra dec }*

| CONVEX [CARTESIAN ]{x y z }*

areaSpec := circleSpec | rectSpec | polySpec | hullSpec | convexSpec

Returns:Returns:

region String SqlString region in normal form ( a union of convexes)

This looks something like 'REGION CONVEX 1 0 0 0 0 1 0 0 CONVEX 0 0 1 0'

create function fHtmRegionToNormalFormString(@region nvarchar(max))

returns table (HtmID_start bigint, HtmID_end bigint)

as external name HTM.Sql.fHtmToNormalForm

select dbo.fHtmRegionToNormalFormString('CIRCLE J2000 195 0 1')

--------------------------------------------------------------

static SqlString Spherical.Htm.Sql.fHtmRegionErrorstatic SqlString Spherical.Htm.Sql.fHtmRegionError (( SqlString SqlString coverspeccoverspec ) ) [static]

fHtmRegionError(coverspec) returns diagnostic message appropriate for a bad region string

Parameters:Parameters:

coverspec a string satisfying the region syntax

Returns:Returns:

diagnostic message: varchar(max)

OK if ok

else message and a syntax string.

create function fHtmRegionError(@region nvarchar(max))

returns varchar(max)

as external name HTM.Sql.fHtmRegionError

print dbo.fHtmRegionError('CIRCLE LATLON 195 ')

See also:See also:

fHtmCover()

the main routine

--------------------------------------------------------------

The documentation for this class was generated from the following file:

Sql.cs

May 27, 2007 György Fekete V 3.1.2

Page 55: VO Course 11: Spatial indexing

HTM SQL APIMain PageMain Page ClassesClasses

Class ListClass List Class MembersClass Members

Spherical.Htm.Sql Member ListSpherical.Htm.Sql Member List

This is the complete list of members for Spherical.Htm.SqlSpherical.Htm.Sql, including all inherited members.

fDistanceEqfDistanceEq(double ra1, double dec1, double ra2, double dec2) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fDistanceLatLonfDistanceLatLon(double lat1, double lon1, double lat2, double lon2) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fDistanceXyzfDistanceXyz(double x1, double y1, double z1, double x2, double y2, double

z2)Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmCoverCircleEqfHtmCoverCircleEq(SqlDouble ra, SqlDouble dec, SqlDouble radiusArcMin) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmCoverCircleLatLonfHtmCoverCircleLatLon(SqlDouble lat, SqlDouble lon, SqlDouble

radiusArcMin)Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmCoverCircleXyzfHtmCoverCircleXyz(SqlDouble x, SqlDouble y, SqlDouble z, SqlDouble

radiusArcMin)Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmCoverListfHtmCoverList(SqlString coverspec) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmCoverRegionfHtmCoverRegion(SqlString coverspec) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmCoverRegionSelectfHtmCoverRegionSelect(SqlString coverspec, SqlString kind) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmCoverTypedRegionfHtmCoverTypedRegion(SqlString coverspec) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmEqfHtmEq(double ra, double dec) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmEqToXyzfHtmEqToXyz(SqlDouble ra, SqlDouble dec) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmLatLonfHtmLatLon(double lat, double lon) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmLatLonToXyzfHtmLatLonToXyz(SqlDouble lat, SqlDouble lon) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmRegionErrorfHtmRegionError(SqlString coverspec) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmRegionToNormalFormStringfHtmRegionToNormalFormString(SqlString coverspec) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmRegionToTablefHtmRegionToTable(SqlString coverspec) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmToCenterPointfHtmToCenterPoint(SqlInt64 HtmID) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmToCornerPointsfHtmToCornerPoints(SqlInt64 HtmID) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmToStringfHtmToString(SqlInt64 HtmID) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmVersionfHtmVersion() Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmXyzfHtmXyz(double x, double y, double z) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmXyzToEqfHtmXyzToEq(SqlDouble x, SqlDouble y, SqlDouble z) Spherical.Htm.SqlSpherical.Htm.Sql [static]

fHtmXyzToLatLonfHtmXyzToLatLon(SqlDouble x, SqlDouble y, SqlDouble z) Spherical.Htm.SqlSpherical.Htm.Sql [static]

NOW ALL IN C# FOR MS SQL SERVER, BUT…

Page 56: VO Course 11: Spatial indexing

HTM SQL API

Page 57: VO Course 11: Spatial indexing

HTM SQL API

Page 58: VO Course 11: Spatial indexing

HTM Regions20/01/10 8:56HTMSqlRegions.html

Página 1 de 1file:///Users/jdsant/Documents/ESO/Catalog%20Facility/HTMSqlRegions.html

coverSpec => polySpec | rectSpec | circleSpec |regionSpec | hullSpeccircleSpec => CIRCLE J2000 [Ln] ra dec radArcMin |CIRCLE CARTESIAN [ln] x y z radArcMincoverSpec => polySpec | rectSpec | circleSpec |regionSpec | hullSpeccircleSpec => CIRCLE J2000 [Li] ra dec rad |CIRCLE CARTESIAN [Li] x y z radrectSpec => RECT J2000 {ra dec}4 | RECT CARTESIAN{x y z }4polySpec => POLY [J2000] {ra dec} | POLY CARTESIAN{x y z}3+hullSpec => CHULL J2000 {ra dec}3+ (Cartesian notimplemented currently)convexSpec => CONVEX { x y z D}+regionSpec => REGION {convexSpec}+

Page 59: VO Course 11: Spatial indexing

pgSphere objects

Page 60: VO Course 11: Spatial indexing

pgSphere objects

SPOINTspoint '(0.1,-0.2)'

spoint '( 10.1d, -90d)'

spoint '( 10d 12m 11.3s, -13d 14m)'

spoint '( 23h 44m 10s, -1.4321 )'

FORMAT STRINGS

CONSTRUCTOR FUNCTIONSSPOINT(0.1,-0.2)

SPOINT(RADIANS(10.1D),RADIANS(-90))

SPOINT(RADIANS(RA_FIELD),RADIANS(DECL_FIELD))

Page 61: VO Course 11: Spatial indexing

pgSphere objects

SCIRCLESCIRCLE '< (0D, 90D), 5D >'

SCIRCLE '< (0D, 90D), 0.5 >'

FORMAT STRINGS

CONSTRUCTOR FUNCTIONSSCIRCLE(SPOINT(0.1,-0.2),0.2)

SCIRCLE(SPOINT(RADIANS(50.0),RADIANS(-59.0)),RADIANS(1))

SCIRCLE(SPOINT(RADIANS(TARGET_RA), RADIANS(TARGET_DECL), RADIANS(SR))

Page 62: VO Course 11: Spatial indexing

pgSphere objects

SELLIPSESELLIPSE '< { 10D, 5D } , ( 20D, 0D ), 90D >'

FORMAT STRINGS

CONSTRUCTOR FUNCTIONSSELLIPSE(SPOINT(0.1,-0.2), 0.3,0.1, 0.2)

SELLIPSE(SPOINT(RADIANS(RA),RADIANS(DECL)), RADIANS(ERR_MAJ),RADIANS(ERR_MIN),RADIANS(ERR_ANG))

Page 63: VO Course 11: Spatial indexing

pgSphere objects

USE CONSTRUCTORS!

Page 64: VO Course 11: Spatial indexing

pgSphere operatorsbinary boolean

equality (=)

inclusion and overlap (see next slide)

binary scalar

angular distance (<->)

unary scalar

length (of line or circumference; @-@)

center (@@)

Page 65: VO Course 11: Spatial indexing

Inclusion and overlap

pgSphere 1.1

Prev Next

5. Operators

5.1. Casting

pgSphere provides some casting operators. So, you can transform an object to another

data type. A cast is done using a CAST(x AS typename), x::typename or typename(x) construct.

Table 2. Castings

casting

argument

type

targetreturns

spoint scircle circle with center positionspoint and radius 0.0

spoint sellipse an ellipse at position spointand radius 0.0

spoint sline a line with length 0.0 atposition spoint

scircle sellipse the scircle as sellipse

sline strans the Euler transformation ofsline

sellipse scircle the bounding circle of sellipse

sellipse strans the Euler transformation ofsellipse

Example 23. Cast a spherical point as a circle

sql> SELECT CAST ( spoint '(10d,20d)' AS scircle ); scircle-------------------- <(10d , 20d) , 0d>(1 row)

5.2. Equality

All data types of pgSphere have equality operators. The equality operator is as in SQL =.

Furthermore, there are two valid negators to indicate that two objects are not equal: !=

and <>.

Example 24. Equality of two spherical points

sql> SELECT spoint '(10d,20d)' = spoint '(370d,20d)' ; test------ t(1 row)

5.3. Contain and overlap

On sphere, an equality relationship is rarely used. There are frequently questions like Is

object a contained by object b? or Does object a overlap object b? pgSphere supports such

queries using binary operators returning true or false:

Table 3. Contain and overlap operators

operator operator returns true, if

@ the left object is contained by rightobject

˜ the left object contains right object

!@ the left object is not contained by rightobject

!˜ the left object does not contain rightobject

&& the objects overlap each other

!&& the objects do not overlap each other

An overlap or contain operator does not exist for all combinations of data types. For

instance, scircle @ spoint is useless because a spherical point can never contain a

spherical circle.

Example 25. Is the left circle contained by the right circle?

sql> SELECT scircle '<(0d,20d),2d>' @ scircle '<(355d,20d),10d>' AS test ;test------ t(1 row)

Example 26. Are the circles overlapping?

sql> SELECT scircle '<(0d,20d),2d>' && scircle '<(199d,-10d),10d>' AS test ; test------ f(1 row)

5.4. Crossing of lines

Another binary relationship is crossing. pgSphere supports only crossing of lines. The

correlative operator is named #.

Example 27. Are the lines crossed?

sql> SELECT sline '(0d,0d,0d),10d' # sline '(90d,5d,5d,XYZ),10d' AS test ; test------ t(1 row)

5.5. Distance

The binary distance operator <-> is a non-boolean operator returning the distance between

two objects in radians. Currently, pgSphere supports only distances between points,

circles, and between point and circle. If the objects are overlapping, the distance operator

returns zero (0.0).

Example 28. Distance between two circles

sql> SELECT 180 * ( scircle '<(0d,20d),2d>' <-> scircle '<(0d,40d),2d>' ) / pi() AS dist ; dist------ 16(1 row)

5.6. Length and circumference

The length/circumference operator @-@ is a non-boolean unary operator returning the

cirumference or length of an object. In the current implementation, pgSphere supports

only circumferences of circles, polygons, and boxes. It supports lengths of lines and paths

too. Instead of using the operator, you can use the functions circum(object) or

length(object).

Example 29. Circumference of a circle

sql> SELECT 180 * ( @-@ scircle '<(0d,20d),30d>' )/ pi() AS circ ; circ------ 180(1 row)

Example 30. Length of a line

sql> SELECT 180 * ( @-@ sline '(0d,0d,0d),30d' )/ pi() AS length ; length-------- 30(1 row)

5.7. Center

The center operator @@ is a non-boolean unary operator returning the center of an object.

In the current implementation of pgSphere, only centers of circles and ellipses are

supported. Instead of using the operator, you can use the function center(object).

Example 31. Center of a circle

sql> SELECT @@ scircle '<(0d,20d),30d>';

5.8. Change the direction

The unary operator - changes the direction of sline or spath objects. You can use it with a

Euler transformation object in the figurative sense, too (Section 5.10).

Example 32. Swap begin and end of a sline

sql> SELECT - sline (spoint '(0d,0d)', spoint '(10d,0d)');

5.9. Turn the path of a line

The unary operator ! turns the path of sline objects, but preserves begin and end of the

spherical line. The length of returned line will be 360° minus the line length of operator's

argument.

The operator ! returns NULL, if the length of sline argument is 0, because the path of

returned sline is undefined.

Example 33. Return length and Check if north pole on slines

sql> SELECT set_sphere_output('DEG'); set_sphere_output ------------------- SET DEG(1 row)

sql> SELECT length ( sline ( spoint '(0d,0d)', spoint '(0d,10d)' ) ) * 180.0 / pi() AS length; length -------- 10(1 row)

sql> SELECT spoint '(0d,90d)' @ sline ( spoint '(0d,0d)', spoint '(0d,10d)' ) AS test; test ------ f(1 row)

sql> SELECT length ( ! sline ( spoint '(0d,0d)', spoint '(0d,10d)' ) ) * 180.0 / pi() AS length; length -------- 350(1 row)

sql> SELECT spoint '(0d,90d)' @ ! sline ( spoint '(0d,0d)', spoint '(0d,10d)' ) AS test; test ------ t(1 row)

5.10. Transformation

As in a plane, translations and rotations are needed to do object or coordinate

transformations. With pgSphere, it is done using Euler transformations (strans). On a

sphere, there aren't real translations. All movements on a sphere are rotations around

axes.

The general syntax for a transformation is always:

object operator euler

where operators are + for a usual transformation, - for an inverse transformation. You can

transform any object having a pgSphere data type, except the data type sbox.

Example 34. Transformation of a point

Rotate a spherical point counterclockwise, first 90° around the x-axis, second 90° around

the z-axis, and last 40.5° around the x-axis.

sql> SELECT set_sphere_output('DEG'); set_sphere_output------------------- SET DEG(1 row)

sql> SELECT spoint '(30d,0d)' + strans '90d, 90d, 40.5d, XZX AS spoint'; spoint--------------- (90d , 70.5d)(1 row)

You can use the + and - operator as unary operators for transformations, too. +strans just

returns the transformation itself, -strans returns the inverse transformation.

Example 35. An inverse transformation

sql> SELECT set_sphere_output('DEG'); set_sphere_output------------------- SET DEG(1 row)

sql> SELECT - strans '20d, 50d, 80d, XYZ' AS inverted; inverted----------------------- 280d, 310d, 340d, ZYX(1 row)

Prev Home NextConstructors Functions

Page 66: VO Course 11: Spatial indexing

create procedure safcat.fConeSearch(in ra double, in decl double, in sr double)begin! declare decl_start double;! declare decl_end double;! declare ra_start double;! declare ra_end double;! declare ra_sr double;! declare nx double;! declare ny double;! declare nz double;! set nx = cos(radians(ra)) * cos(radians(decl));! set ny = sin(radians(ra)) * cos(radians(decl));! set nz = sin(radians(decl));! set decl_start = decl - abs(sr);! if decl_start < -90 then! ! set decl_start = -90.0;! end if ;! set decl_end = decl + abs(sr);! if decl_end > 90 then! ! set decl_end = 90.0;! end if ;! if abs(cos(radians(decl))) < 0.00001 then! ! set ra_start = 0;! ! set ra_end = 360;! else! ! set ra_sr = degrees(2 * asin( sin(radians(sr)/2) / cos(radians(decl))));! ! set ra_start = ra - ra_sr;! ! set ra_end = ra + ra_sr;! end if ;! if ra_start < 0 then! ! select row_id, ra, decl, cx, cy, cz, b, v, htm20 from htm20test! ! where decl between decl_start and decl_end! ! and (ra between ra_start+360 and 360 or! ! ra between 0 and ra_end)! ! and ((nx*cx+ny*cy+nz*cz) > cos (radians(sr)))! else! ! if ra_end > 360 then! ! ! select row_id, ra, decl, cx, cy, cz, b, v, htm20 from htm20test! ! ! where decl between decl_start and decl_end! ! ! and (ra between 0 and ra_end - 360 or! ! ! ra between ra_start and 360)! ! ! and ((nx*cx+ny*cy+nz*cz) > cos (radians(sr)))! ! else! ! ! select row_id, ra, decl, cx, cy, cz, b, v, htm20 from htm20test! ! ! where decl between decl_start and decl_end! ! ! and ra between ra_start and ra_end! ! ! and ((nx*cx+ny*cy+nz*cz) > cos (radians(sr)))! ! end if;! end if;end ;

Spatial Indexing Primer

Example

Cone Search with RA and Decl restrictions

Page 67: VO Course 11: Spatial indexing

create procedure safcat.fConeSearch(in ra double, in decl double, in sr double)begin! declare decl_start double;! declare decl_end double;! declare ra_start double;! declare ra_end double;! declare ra_sr double;! declare nx double;! declare ny double;! declare nz double;! set nx = cos(radians(ra)) * cos(radians(decl));! set ny = sin(radians(ra)) * cos(radians(decl));! set nz = sin(radians(decl));! set decl_start = decl - abs(sr);! if decl_start < -90 then! ! set decl_start = -90.0;! end if ;! set decl_end = decl + abs(sr);! if decl_end > 90 then! ! set decl_end = 90.0;! end if ;! if abs(cos(radians(decl))) < 0.00001 then! ! set ra_start = 0;! ! set ra_end = 360;! else! ! set ra_sr = degrees(2 * asin( sin(radians(sr)/2) / cos(radians(decl))));! ! set ra_start = ra - ra_sr;! ! set ra_end = ra + ra_sr;! end if ;! if ra_start < 0 then! ! select row_id, ra, decl, cx, cy, cz, b, v, htm20 from htm20test! ! where decl between decl_start and decl_end! ! and (ra between ra_start+360 and 360 or! ! ra between 0 and ra_end)! ! and ((nx*cx+ny*cy+nz*cz) > cos (radians(sr)))! else! ! if ra_end > 360 then! ! ! select row_id, ra, decl, cx, cy, cz, b, v, htm20 from htm20test! ! ! where decl between decl_start and decl_end! ! ! and (ra between 0 and ra_end - 360 or! ! ! ra between ra_start and 360)! ! ! and ((nx*cx+ny*cy+nz*cz) > cos (radians(sr)))! ! else! ! ! select row_id, ra, decl, cx, cy, cz, b, v, htm20 from htm20test! ! ! where decl between decl_start and decl_end! ! ! and ra between ra_start and ra_end! ! ! and ((nx*cx+ny*cy+nz*cz) > cos (radians(sr)))! ! end if;! end if;end ;

Spatial Indexing Primer

Example

Cone Search with RA and Decl restrictions

Page 68: VO Course 11: Spatial indexing

Spatial Indexing Primer

Example

Cone Search with RA and Decl restrictions

select row_id, ra, decl, cx, cy, cz, b, v, htm20 from htm20testwhere decl between decl_start and decl_end and ra between ra_start and ra_end and ((nx*cx+ny*cy+nz*cz) > cos (radians(sr)))

Page 69: VO Course 11: Spatial indexing

Spatial Indexing Primer

Example

Cone Search with HTM

HTMindexImp index = (HTMindexImp) new HTMindexImp(20, 5);

Vector3d vect = new Vector3d(ra, decl);double dist = Math.cos(radians(sr));Convex convex = new Convex();Constraint constraint = new Constraint(vect, dist);convex.add(constraint);convex.simplify();

Domain domain = new Domain();domain.add(convex);

domain.setOlevel(20);HTMrange htmRange = new HTMrange();

domain.intersect(index, htmRange, false);

StringBuilder queryHtmTable = new StringBuilder( "select row_id, ra, decl, cx, cy, cz, b, v, htm20\n”+ “from htm20test\nwhere\n");

htmRange.reset();boolean isFirst = true;long[] range = htmRange.getNext();while ((range != null) && (range[0] > 0)) { String betweenClause; if (isFirst) { betweenClause = String.format(" (htm20 between %014d and %014d)\n", range[0], range[1]); isFirst = false; } else { betweenClause = String.format(" or (htm20 between %014d and %014d)\n", range[0], range[1]); } queryHtmTable.append(betweenClause); range = htmRange.getNext();}

String finalQuery;if (htmRange.nranges() > 0) { finalQuery = queryHtmTable.toString();} else { finalQuery = "select row_id, ra, decl, cx, cy, cz, b, v, htm20 from htm20test where htm20 < 0";}

Page 70: VO Course 11: Spatial indexing

Spatial Indexing Primer

Example

Cone Search with HTM

select row_id, ra, decl, cx, cy, cz, b, v, htm20from htm20testwhere (htm20 between 13469017440256 and 13469084549119) or (htm20 between 13469239738368 and 13469239803903) or (htm20 between 13469239869440 and 13469239934975) or (htm20 between 13469239951360 and 13469239952383) or (htm20 between 13469239952896 and 13469239952896) or (htm20 between 13469239954944 and 13469239954944) or (htm20 between 13469239954946 and 13469239954946) or (htm20 between 13469239954947 and 13469239954947) or (htm20 between 13469260709888 and 13469260775423) or (htm20 between 13469260775424 and 13469260840959) or (htm20 between 13469260939264 and 13469260940287) or (htm20 between 13469260941568 and 13469260941568) or (htm20 between 13469260942592 and 13469260942592) or (htm20 between 13469260942593 and 13469260942593) or (htm20 between 13469260942595 and 13469260942595) or (htm20 between 13469269098496 and 13469269102591) or (htm20 between 14568529068032 and 14568596176895) or (htm20 between 14568751366144 and 14568751431679) or (htm20 between 14568751497216 and 14568751562751) or (htm20 between 14568751579136 and 14568751580159) or (htm20 between 14568751580672 and 14568751580672) or (htm20 between 14568751582720 and 14568751582720) or (htm20 between 14568751582722 and 14568751582722) or (htm20 between 14568751582723 and 14568751582723) or (htm20 between 14568772337664 and 14568772403199) or (htm20 between 14568772403200 and 14568772468735) or (htm20 between 14568772567040 and 14568772568063) or (htm20 between 14568772569344 and 14568772569344) or (htm20 between 14568772570368 and 14568772570368) or (htm20 between 14568772570369 and 14568772570369) or (htm20 between 14568772570371 and 14568772570371) or (htm20 between 14568780726272 and 14568780730367) or (htm20 between 15668040695808 and 15668107804671) or (htm20 between 15668262993920 and 15668263059455) or (htm20 between 15668263124992 and 15668263190527) or (htm20 between 15668263206912 and 15668263207935) or (htm20 between 15668263208448 and 15668263208448) or (htm20 between 15668263210496 and 15668263210496) or (htm20 between 15668263210498 and 15668263210498) or (htm20 between 15668263210499 and 15668263210499) or (htm20 between 15668283965440 and 15668284030975) or (htm20 between 15668284030976 and 15668284096511) or (htm20 between 15668284194816 and 15668284195839) or (htm20 between 15668284197120 and 15668284197120) or (htm20 between 15668284198144 and 15668284198144) or (htm20 between 15668284198145 and 15668284198145) or (htm20 between 15668284198147 and 15668284198147) or (htm20 between 15668292354048 and 15668292358143) or (htm20 between 16767552323584 and 16767619432447) or (htm20 between 16767774621696 and 16767774687231) or (htm20 between 16767774752768 and 16767774818303) or (htm20 between 16767774834688 and 16767774835711) or (htm20 between 16767774836224 and 16767774836224) or (htm20 between 16767774838272 and 16767774838272) or (htm20 between 16767774838274 and 16767774838274) or (htm20 between 16767774838275 and 16767774838275) or (htm20 between 16767795593216 and 16767795658751) or (htm20 between 16767795658752 and 16767795724287) or (htm20 between 16767795822592 and 16767795823615) or (htm20 between 16767795824896 and 16767795824896) or (htm20 between 16767795825920 and 16767795825920) or (htm20 between 16767795825921 and 16767795825921) or (htm20 between 16767795825923 and 16767795825923) or (htm20 between 16767803981824 and 16767803985919)

Page 71: VO Course 11: Spatial indexing

Is this Really Faster?

Page 72: VO Course 11: Spatial indexing

Sybase IQ TM Query PlanQuery: Version: 15.2.0.5604/100518/P/GA/Enterprise Linux64 - x86_64 - 2.6.9-67.0.4.ELsmp/64bit

Query Tree| 392 rows

#03 Root| 392 rows

#04 Scrolling Cursor Store| 392 rows

#08 Parallel Combiner|| || 5596 rows

#02 Filter||| ||| 2056400 rows

#01 Leaf <safcat.htm20test>

Query Timings

Timing Legend Condition Execution Prepare 1st Fetch Subsequent Fetches Complete

Elapsed Time (sec) 1.362 2.724 4.086 5.448 6.81 8.172 9.534 10.896 12.258 13.62#03 Root . . . . . . . . . . .#04 Scrolling Cursor Store . . . . . . . . . . . .#08 Parallel Combiner .. . . . . . . . . . . .#02 Filter ... . . . . . . . . . . .#01 Leaf .... . . . . . . . . . . .

Threads3

2

1

.. . . 08 08 08 08 . .

.

. . . . . . . . . .

CPU %

100

95

90

85

80

75

70

65

60

55

50

45

40

35

30

25

20

15

10

5

.

. . .

.

.

..

. .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

. .

Wall Time 00:01:02.363 00:01:05.088 00:01:07.813 00:01:10.538 00:01:13.263

Query Text select htm20test.row_id,htm20test.ra,htm20test.decl,htm20test.cx,htm20test.cy,htm20test.cz,htm20test.b,htm20test.v,htm20test.htm20 from htm20test where nx*htm20test.cx+ny*htm20test.cy+nz*htm20test.cz > cos(radians(sr)) and htm20test.ra between ra_start and ra_end and htm20test.decl between decl_start and decl_end

Query Detail#03 Root

Child Node 1 #04Generated Result Rows 392Estimated Result Rows 640000User Name safcat (SA connHandle: 100 SA connID: 15)Est. Temp Space Used (Mb) 41.1Act. Temp Space Used (Mb) 1.5Cursor Name *SQL_CUR_2aaafd3976f0Requested attributes Scroll Read Only Hold ChainedEffective Number of Users 1Number of CPUs 2IQ Main Cache Size (Mb) 3200IQ Temp Cache Size (Mb) 2400Threads used for executing local invariant predicates 1Option Query_Plan_As_HTML ONOption FP_Lookup_Size 16Simplification 1 source RADIANS(HV(sr = 0.500000000000000000))Simplification 1 result 0.00872664625997164774Time of Cursor Creation 2011-02-16 00:01:02.363586Time of First Prepare 2011-02-16 00:01:02.401792Time of First Prepare Return 2011-02-16 00:01:02.402780Time of First Fetch Call 2011-02-16 00:01:02.403045Time of First Fetch Return 2011-02-16 00:01:03.561003Time of Complete Call 2011-02-16 00:01:15.977550Time of Complete Return 2011-02-16 00:01:15.977559Elapsed Condition time 0:00:00.000000Elapsed time 0:00:13.613973Production 1 (SACast ((safcat.htm20test.b))Production 2 (SACast ((safcat.htm20test.cz))Production 3 (SACast ((safcat.htm20test.cx))Production 4 (SACast ((safcat.htm20test.v))Production 5 (SACast ((safcat.htm20test.ra))Production 6 (SACast ((safcat.htm20test.decl))Production 7 (SACast ((safcat.htm20test.cy))Output Vector 9 entries (92 data bytes)Output 1 safcat.htm20test.row_idOutput 1 Data Type bigint (19, 0)Output 1 Base Distincts (Est.) 48978Output 1 Indexes FPOutput 2 (SACast ((safcat.htm20test.ra))Output 2 Data Type numeric (14, 10)Output 3 (SACast ((safcat.htm20test.decl))Output 3 Data Type numeric (14, 10)Output 4 (SACast ((safcat.htm20test.cx))Output 4 Data Type numeric (13, 10)Output 5 (SACast ((safcat.htm20test.cy))Output 5 Data Type numeric (13, 10)Output 6 (SACast ((safcat.htm20test.cz))Output 6 Data Type numeric (13, 10)Output 7 (SACast ((safcat.htm20test.b))Output 7 Data Type numeric (6, 3)Output 8 (SACast ((safcat.htm20test.v))Output 8 Data Type numeric (6, 3)Output 9 safcat.htm20test.htm20Output 9 Data Type bigint (19, 0)Output 9 Base Distincts 9999977Output 9 Est. Filtered Distincts 640000Output 9 Indexes FP, HG

#04 Scrolling Cursor StoreParent Node #03Child Node 1 #08Generated Result Rows 392Estimated Result Rows 640000Time of First Prepare 2011-02-16 00:01:02.401799Time of First Prepare Return 2011-02-16 00:01:02.402775Time of First Fetch Call 2011-02-16 00:01:02.403051Time of First Fetch Return 2011-02-16 00:01:03.560998Time of Complete Call 2011-02-16 00:01:15.977460Time of Complete Return 2011-02-16 00:01:15.977542Elapsed time 0:00:13.613956Output Vector 9 entries (64 data bytes)Output 1 safcat.htm20test.row_idOutput 2 safcat.htm20test.raOutput 3 safcat.htm20test.declOutput 4 safcat.htm20test.cxOutput 5 safcat.htm20test.cyOutput 6 safcat.htm20test.czOutput 7 safcat.htm20test.bOutput 8 safcat.htm20test.vOutput 9 safcat.htm20test.htm20

#08 Parallel CombinerParent Node #04Child Node 1 #02Generated Result Rows 392Estimated Result Rows 640000Max. Possible Parallel Arms 2Max. Active Parallel Threads 2Parallel Sink Work Units 2Time of First Prepare 2011-02-16 00:01:02.402549Time of First Prepare Return 2011-02-16 00:01:02.402771Time of First Fetch Call 2011-02-16 00:01:02.403056Time of First Fetch Return 2011-02-16 00:01:03.560987Time of Complete Call 2011-02-16 00:01:15.977448Time of Complete Return 2011-02-16 00:01:15.977454Elapsed time 0:00:13.613868Output Vector 9 entries (64 data bytes)Output 1 safcat.htm20test.row_idOutput 1 Data Type bigint (19, 0)Output 1 Base Distincts (Est.) 48978Output 1 Indexes FPOutput 2 safcat.htm20test.raOutput 2 Data Type bigint (14, 10)Output 2 Base Distincts (Est.) 48978Output 2 Indexes FPOutput 3 safcat.htm20test.declOutput 3 Data Type bigint (14, 10)Output 3 Base Distincts (Est.) 48978Output 3 Indexes FPOutput 4 safcat.htm20test.cxOutput 4 Data Type bigint (13, 10)Output 4 Base Distincts (Est.) 48978Output 4 Indexes FPOutput 5 safcat.htm20test.cyOutput 5 Data Type bigint (13, 10)Output 5 Base Distincts (Est.) 48978Output 5 Indexes FPOutput 6 safcat.htm20test.czOutput 6 Data Type bigint (13, 10)Output 6 Base Distincts (Est.) 48978Output 6 Indexes FPOutput 7 safcat.htm20test.bOutput 7 Data Type integer (6, 3)Output 7 Base Distincts (Est.) 48978Output 7 Indexes FPOutput 8 safcat.htm20test.vOutput 8 Data Type integer (6, 3)Output 8 Base Distincts (Est.) 48978Output 8 Indexes FPOutput 9 safcat.htm20test.htm20Output 9 Data Type bigint (19, 0)Output 9 Base Distincts 9999977Output 9 Est. Filtered Distincts 640000Output 9 Indexes FP, HG

#02 FilterParent Node #08Child Node 1 #01GeneratedResult Rows 5596

EstimatedResult Rows 640000

Time of FirstPrepare 2011-02-16 00:01:02.402702

Time of FirstPrepareReturn

2011-02-16 00:01:02.402766

Time of FirstFetch Call 2011-02-16 00:01:02.404885

Time of FirstFetch Return 2011-02-16 00:01:02.405320

Time ofComplete Call 2011-02-16 00:01:15.977438

Time ofCompleteReturn

2011-02-16 00:01:15.977443

Elapsed time 0:00:13.613857

Condition 1(((((HV(nx = 0.0000000000000000612323399573676604) * safcat.htm20test.cx`(1)) + (HV(ny = 0...) * safcat.htm20test.cy`(1))) + (HV(nz = 1.00000000000000000) * safcat.htm20test.cz`(1))) >0.999961923064171310) AND safcat.htm20test.ra`(1) BETWEEN [HV(ra_start = 0...) AND HV(ra_end = 360.000000000000000)] AND safcat.htm20test.decl`(1) BETWEEN [HV(decl_start =89.5000000000000000) AND HV(decl_end = 90.

Condition 1(Fragment 1)

((((HV(nx = 0.0000000000000000612323399573676604) * safcat.htm20test.cx`(1)) + (HV(ny = 0...) * safcat.htm20test.cy`(1))) + (HV(nz = 1.00000000000000000) * safcat.htm20test.cz`(1))) >0.999961923064171310)

Condition 1(Frag. 1)Selectivity

0.40000000

Condition 1(Fragment 2) safcat.htm20test.ra`(1) BETWEEN [HV(ra_start = 0...) AND HV(ra_end = 360.000000000000000)]

Condition 1(Frag. 2)Selectivity

0.40000000

Condition 1(Fragment 3) safcat.htm20test.decl`(1) BETWEEN [HV(decl_start = 89.5000000000000000) AND HV(decl_end = 90.0000000000000000)]

Condition 1(Frag. 3)Selectivity

0.40000000

Output Vector 9 entries (64 data bytes)Output 1 safcat.htm20test.row_id`(1)Output 2 safcat.htm20test.ra`(1)Output 3 safcat.htm20test.decl`(1)Output 4 safcat.htm20test.cx`(1)Output 5 safcat.htm20test.cy`(1)Output 6 safcat.htm20test.cz`(1)Output 7 safcat.htm20test.b`(1)Output 8 safcat.htm20test.v`(1)Output 9 safcat.htm20test.htm20`(1)

#01 LeafTable Name safcat.htm20testParent Node #02Table Row Count 10000000Generated Result Rows 2056400Estimated Result Rows 10000000Parallel Source Work Units 2Initial Source Work Unit size 1028199Time of First Prepare 2011-02-16 00:01:02.402709Time of First Prepare Return 2011-02-16 00:01:02.402761Time of First Fetch Call 2011-02-16 00:01:02.404892Time of First Fetch Return 2011-02-16 00:01:02.405047Time of Complete Call 2011-02-16 00:01:15.977270Time of Complete Return 2011-02-16 00:01:15.977431Elapsed time 0:00:13.613845Production 1 (HV(ny = 0...) * safcat.htm20test.cy`(1))Production 1 Data Type double (16, 0)Production 1 Base Distincts(Est.) 48978

Production 2 (HV(nx = 0.0000000000000000612323399573676604) * safcat.htm20test.cx`(1))Production 2 Data Type double (16, 0)Production 2 Base Distincts(Est.) 48978

Production 3 (HV(nz = 1.00000000000000000) * safcat.htm20test.cz`(1))Production 3 Data Type double (16, 0)Production 3 Base Distincts(Est.) 48978

Production 4 ((HV(nx = 0.0000000000000000612323399573676604) * safcat.htm20test.cx`(1)) + (HV(ny = 0...) * safcat.htm20test.cy`(1)))Production 4 Data Type double (16, 0)Production 4 Base Distincts(Est.) 2398844484

Production 5 (((HV(nx = 0.0000000000000000612323399573676604) * safcat.htm20test.cx`(1)) + (HV(ny = 0...) * safcat.htm20test.cy`(1))) + (HV(nz = 1.00000000000000000) *safcat.htm20test.cz`(1)))

Projection Per Row 9 columns (64 bytes)Output Vector 10 entries (72 data bytes)Output 1 safcat.htm20test.row_id`(1)Output 1 Data Type bigint (19, 0)Output 1 Base Distincts (Est.) 48978Output 1 Indexes FPOutput 2 safcat.htm20test.ra`(1)Output 2 Data Type bigint (14, 10)Output 2 Base Distincts (Est.) 48978Output 2 Indexes FPOutput 3 safcat.htm20test.decl`(1)Output 3 Data Type bigint (14, 10)Output 3 Base Distincts (Est.) 48978Output 3 Indexes FPOutput 4 safcat.htm20test.cx`(1)Output 4 Data Type bigint (13, 10)Output 4 Base Distincts (Est.) 48978Output 4 Indexes FPOutput 5 safcat.htm20test.cy`(1)Output 5 Data Type bigint (13, 10)Output 5 Base Distincts (Est.) 48978Output 5 Indexes FPOutput 6 safcat.htm20test.cz`(1)Output 6 Data Type bigint (13, 10)Output 6 Base Distincts (Est.) 48978Output 6 Indexes FPOutput 7 safcat.htm20test.b`(1)Output 7 Data Type integer (6, 3)Output 7 Base Distincts (Est.) 48978Output 7 Indexes FPOutput 8 safcat.htm20test.v`(1)Output 8 Data Type integer (6, 3)Output 8 Base Distincts (Est.) 48978Output 8 Indexes FPOutput 9 safcat.htm20test.htm20`(1)Output 9 Data Type bigint (19, 0)Output 9 Base Distincts 9999977Output 9 Est. Filtered Distincts 640000Output 9 Indexes FP, HG

Output 10 (((HV(nx = 0.0000000000000000612323399573676604) * safcat.htm20test.cx`(1)) + (HV(ny = 0...) * safcat.htm20test.cy`(1))) + (HV(nz = 1.00000000000000000) *safcat.htm20test.cz`(1)))

Output 10 Data Type double (16, 0)Output 10 Base Distincts (Est.) 117490605137352Maximum Row ID 10000000Start of Partition BM 1End of Partition BM 1028200

SQL CONESEARCHQUERY PLAN

Page 73: VO Course 11: Spatial indexing

Sybase IQ TM Query PlanQuery: Version: 15.2.0.5604/100518/P/GA/Enterprise Linux64 - x86_64 - 2.6.9-67.0.4.ELsmp/64bit

Query Tree| 1 row

#03 Root| 1 row

#04 Scrolling Cursor Store| 1 row

#01 Aggregation Leaf <safcat.htm20test>

Query Timings

Timing Legend Condition Execution Prepare 1st Fetch Subsequent Fetches Complete

Elapsed Time (sec) 6.429 12.858 19.287 25.716 32.145 38.574 45.003 51.432 57.861 64.29#03 Root . . . . . . . . . . .#04 Scrolling Cursor Store . . . . . . . . . . . .#01 Aggregation Leaf .. . . . . . . . . . . .

Threads3

2

1

.. 01 . . . . . . .

.. . .

.

. . . . . . . . . . . . .

CPU %

100

95

90

85

80

75

70

65

60

55

50

45

40

35

30

25

20

15

10

5

.

.

..

. . . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

..

. .

Wall Time 23:59:58.046 00:00:10.905 00:00:23.764 00:00:36.623 00:00:49.482

Query Text select count(row_id)from htm20testwhere (htm20 between 13469017440256 and 13469084549119) or (htm20 between 13469239738368 and 13469239803903) or (htm20 between 13469239869440 and 13469239934975) or (htm20 between 13469239951360 and 13469239952383) or (htm20 between 13469239952896 and 13469239952896) or (htm20 between 13469239954944 and 13469239954944) or (htm20 between 13469239954946 and 13469239954946) or (htm20 between 13469239954947 and 13469239954947) or (htm20 between 13469260709888 and 13469260775423) or (htm20 between 13469260775424 and 13469260840959) or (htm20 between 13469260939264 and 13469260940287) or (htm20 between 13469260941568 and 13469260941568) or (htm20 between 13469260942592 and 13469260942592) or (htm20 between 13469260942593 and 13469260942593) or (htm20 between 13469260942595 and 13469260942595) or (htm20 between 13469269098496 and 13469269102591) or (htm20 between 14568529068032 and 14568596176895) or (htm20 between 14568751366144 and 14568751431679) or (htm20 between 14568751497216 and 14568751562751) or (htm20 between 14568751579136 and 14568751580159) or (htm20 between 14568751580672 and 14568751580672) or (htm20 between 14568751582720 and 14568751582720) or (htm20 between 14568751582722 and 14568751582722) or (htm20 between 14568751582723 and 14568751582723) or (htm20 between 14568772337664 and 14568772403199) or (htm20 between 14568772403200 and 14568772468735) or (htm20 between 14568772567040 and 14568772568063) or (htm20 between 14568772569344 and 14568772569344) or (htm20 between 14568772570368 and 14568772570368) or (htm20 between 14568772570369 and 14568772570369) or (htm20 between 14568772570371 and 14568772570371) or (htm20 between 14568780726272 and 14568780730367) or (htm20 between 15668040695808 and 15668107804671) or (htm20 between 15668262993920 and 15668263059455) or (htm20 between 15668263124992 and 15668263190527) or (htm20 between 15668263206912 and 15668263207935) or (htm20 between 15668263208448 and 15668263208448) or (htm20 between 15668263210496 and 15668263210496) or (htm20 between 15668263210498 and 15668263210498) or (htm20 between 15668263210499 and 15668263210499) or (htm20 between 15668283965440 and 15668284030975) or (htm20 between 15668284030976 and 15668284096511) or (htm20 between 15668284194816 and 15668284195839) or (htm20 between 15668284197120 and 15668284197120) or (htm20 between 15668284198144 and 15668284198144) or (htm20 between 15668284198145 and 15668284198145) or (htm20 between 15668284198147 and 15668284198147) or (htm20 between 15668292354048 and 15668292358143) or (htm20 between 16767552323584 and 16767619432447) or (htm20 between 16767774621696 and 16767774687231) or (htm20 between 16767774752768 and 16767774818303) or (htm20 between 16767774834688 and 16767774835711) or (htm20 between 16767774836224 and 16767774836224) or (htm20 between 16767774838272 and 16767774838272) or (htm20 between 16767774838274 and 16767774838274) or (htm20 between 16767774838275 and 16767774838275) or (htm20 between 16767795593216 and 16767795658751) or (htm20 between 16767795658752 and 16767795724287) or (htm20 between 16767795822592 and 16767795823615) or (htm20 between 16767795824896 and 16767795824896) or (htm20 between 16767795825920 and 16767795825920) or (htm20 between 16767795825921 and 16767795825921) or (htm20 between 16767795825923 and 16767795825923) or (htm20 between 16767803981824 and 16767803985919)

Query Detail#03 Root

Child Node 1 #04Generated Result Rows 1Estimated Result Rows 1User Name safcat (SA connHandle: 100 SA connID: 15)Est. Temp Space Used (Mb) 32.5Act. Temp Space Used (Mb) 2.0Cursor Name SQL_CUR_2aaafd3976f0Requested attributes Scroll Read Only Hold ChainedEffective Number of Users 1Number of CPUs 2IQ Main Cache Size (Mb) 3200IQ Temp Cache Size (Mb) 2400Threads used for executing local invariant predicates 1Option Query_Plan_As_HTML ONOption FP_Lookup_Size 16Time of Cursor Creation 2011-02-15 23:59:58.046063Time of First Prepare 2011-02-15 23:59:58.281595Time of First Prepare Return 2011-02-15 23:59:58.282171Time of First Fetch Call 2011-02-15 23:59:58.282389Time of First Fetch Return 2011-02-15 23:59:58.282786Time of Complete Call 2011-02-16 00:01:02.305725Time of Complete Return 2011-02-16 00:01:02.305731Elapsed Condition time 0:00:00.160952Working time 0:00:00.238441Elapsed time 0:01:04.259668Output Vector 1 entries (8 data bytes)Output 1 COUNT(safcat.htm20test.row_id)Output 1 Data Type unsigned bigint (20, 0)Output 1 Base Distincts 1

#04 Scrolling Cursor StoreParent Node #03Child Node 1 #01Generated Result Rows 1Estimated Result Rows 1Time of First Prepare 2011-02-15 23:59:58.281607Time of First Prepare Return 2011-02-15 23:59:58.282166Time of First Fetch Call 2011-02-15 23:59:58.282396Time of First Fetch Return 2011-02-15 23:59:58.282781Time of Complete Call 2011-02-16 00:01:02.305607Time of Complete Return 2011-02-16 00:01:02.305711Elapsed time 0:01:04.259648Output Vector 1 entries (8 data bytes)Output 1 COUNT(safcat.htm20test.row_id)

#01 Aggregation LeafTable Name safcat.htm20testParent Node #04Table RowCount 10000000

GeneratedResult Rows 1

EstimatedResult Rows 1

GeneratedPostInvariantPredicateRows

31287

EstimatedPostInvariantPredicateRows

31250

ValidGroupingAlgorithms

Vertical, Hash, Sort

InvariantPredicateThreadAllowance

7

Time ofConditionStart

2011-02-15 23:59:58.118185

Time ofConditionDone

2011-02-15 23:59:58.279137

Time of FirstPrepare 2011-02-15 23:59:58.282049

Time of FirstPrepareReturn

2011-02-15 23:59:58.282160

Time of FirstFetch Call 2011-02-15 23:59:58.282402

Time of FirstFetch Return 2011-02-15 23:59:58.282772

Time ofCompleteCall

2011-02-15 23:59:58.282982

Time ofCompleteReturn

2011-02-15 23:59:58.284478

ElapsedConditiontime

0:00:00.160952

Elapsed time 0:00:00.238415

Condition 1(Invariant)

(safcat.htm20test.htm20 BETWEEN [13469017440256 AND 13469084549119] OR safcat.htm20test.htm20 BETWEEN[13469239738368 AND 13469239803903] OR safcat.htm20test.htm20 BETWEEN [13469239869440 AND13469239934975] OR safcat.htm20test.htm20 BETWEEN [13469239951360 AND 13469239952383] ORsafcat.htm20test.htm20 BETWEEN [13469239952896 AND 13469239952896] OR safcat.htm20test.htm20 BETWEEN[134692399549

Condition 1Selectivity 0.00312502

Condition 1Usefulness 0.99687498

Condition 1Elapsed time 0:00:00.160922

Condition 1Rowsremainingaftercondition

31287

Condition 1(Fragment 1) safcat.htm20test.htm20 BETWEEN [13469017440256 AND 13469084549119]

Condition 1(Frag. 1)Selectivity

0.00077240

Condition 1(Frag. 1)Usefulness

8.99922760

Condition 1(Frag. 1)Distincts inRange

7720

Condition 1(Frag. 1)Elapsed time

0:00:00.011653

Condition 1(Frag. 1)Rowsremainingaftercondition

7724

Condition 1(Frag. 1)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 10 HNG: 3.33333 HG: 0.33862

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment 2) safcat.htm20test.htm20 BETWEEN [13469239738368 AND 13469239803903]

Condition 1(Frag. 2)Selectivity

0.00000070

Condition 1(Frag. 2)Usefulness

8.99999930

Condition 1(Frag. 2)Distincts inRange

7

Condition 1(Frag. 2)Elapsed time

0:00:00.005761

Condition 1(Frag. 2)Rowsremainingaftercondition

7731

Condition 1(Frag. 2)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment 3) safcat.htm20test.htm20 BETWEEN [13469239869440 AND 13469239934975]

Condition 1(Frag. 3)Selectivity

0.00000040

Condition 1(Frag. 3)Usefulness

8.99999960

Condition 1(Frag. 3)Distincts inRange

4

Condition 1(Frag. 3)Elapsed time

0:00:00.005702

Condition 1(Frag. 3)Rowsremainingaftercondition

7735

Condition 1(Frag. 3)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment 4) safcat.htm20test.htm20 BETWEEN [13469239951360 AND 13469239952383]

Condition 1(Frag. 4)Selectivity

0.00000000

Condition 1(Frag. 4)Usefulness

2.00000000

Condition 1(Frag. 4)Elapsed time

0:00:00.001430

Condition 1(Frag. 4)Rowsremainingaftercondition

7735

Condition 1(Frag. 4)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.5058 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment 5) safcat.htm20test.htm20 BETWEEN [13469239952896 AND 13469239952896]

Condition 1(Frag. 5)Selectivity

0.00000000

Condition 1(Frag. 5)Usefulness

2.00000000

Condition 1(Frag. 5)Elapsed time

0:00:00.000204

Condition 1(Frag. 5)Rowsremainingaftercondition

7735

Condition 1(Frag. 5)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment 6) safcat.htm20test.htm20 BETWEEN [13469239954944 AND 13469239954944]

Condition 1(Frag. 6)Selectivity

0.00000000

Condition 1(Frag. 6)Usefulness

2.00000000

Condition 1(Frag. 6)Elapsed time

0:00:00.000199

Condition 1(Frag. 6)Rowsremainingaftercondition

7735

Condition 1(Frag. 6)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment 7) safcat.htm20test.htm20 BETWEEN [13469239954946 AND 13469239954946]

Condition 1(Frag. 7)Selectivity

0.00000000

Condition 1(Frag. 7)Usefulness

2.00000000

Condition 1(Frag. 7)Elapsed time

0:00:00.000193

Condition 1(Frag. 7)Rowsremainingaftercondition

7735

Condition 1(Frag. 7)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment 8) safcat.htm20test.htm20 BETWEEN [13469239954947 AND 13469239954947]

Condition 1(Frag. 8)Selectivity

0.00000000

Condition 1(Frag. 8)Usefulness

2.00000000

Condition 1(Frag. 8)Elapsed time

0:00:00.000189

Condition 1(Frag. 8)Rowsremainingaftercondition

7735

Condition 1(Frag. 8)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment 9) safcat.htm20test.htm20 BETWEEN [13469260709888 AND 13469260775423]

Condition 1(Frag. 9)Selectivity

0.00000010

Condition 1(Frag. 9)Usefulness

9.99999990

Condition 1(Frag. 9)Distincts inRange

1

Condition 1(Frag. 9)Elapsed time

0:00:00.003255

Condition 1(Frag. 9)Rowsremainingaftercondition

7736

Condition 1(Frag. 9)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment10)

safcat.htm20test.htm20 BETWEEN [13469260775424 AND 13469260840959]

Condition 1(Frag. 10)Selectivity

0.00000090

Condition 1(Frag. 10)Usefulness

8.99999910

Condition 1(Frag. 10)Distincts inRange

9

Condition 1(Frag. 10)Elapsed time

0:00:00.006132

Condition 1(Frag. 10)Rowsremainingaftercondition

7745

Condition 1(Frag. 10)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment11)

safcat.htm20test.htm20 BETWEEN [13469260939264 AND 13469260940287]

Condition 1(Frag. 11)Selectivity

0.00000000

Condition 1(Frag. 11)Usefulness

2.00000000

Condition 1(Frag. 11)Elapsed time

0:00:00.001449

Condition 1(Frag. 11)Rowsremainingaftercondition

7745

Condition 1(Frag. 11)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.50581 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment12)

safcat.htm20test.htm20 BETWEEN [13469260941568 AND 13469260941568]

Condition 1(Frag. 12)Selectivity

0.00000000

Condition 1(Frag. 12)Usefulness

2.00000000

Condition 1(Frag. 12)Elapsed time

0:00:00.000339

Condition 1(Frag. 12)Rowsremainingaftercondition

7745

Condition 1(Frag. 12)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment13)

safcat.htm20test.htm20 BETWEEN [13469260942592 AND 13469260942592]

Condition 1(Frag. 13)Selectivity

0.00000000

Condition 1(Frag. 13)Usefulness

2.00000000

Condition 1(Frag. 13)Elapsed time

0:00:00.000196

Condition 1(Frag. 13)Rowsremainingaftercondition

7745

Condition 1(Frag. 13)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment14)

safcat.htm20test.htm20 BETWEEN [13469260942593 AND 13469260942593]

Condition 1(Frag. 14)Selectivity

0.00000000

Condition 1(Frag. 14)Usefulness

2.00000000

Condition 1(Frag. 14)Elapsed time

0:00:00.000192

Condition 1(Frag. 14)Rowsremainingaftercondition

7745

Condition 1(Frag. 14)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment15)

safcat.htm20test.htm20 BETWEEN [13469260942595 AND 13469260942595]

Condition 1(Frag. 15)Selectivity

0.00000000

Condition 1(Frag. 15)Usefulness

2.00000000

Condition 1(Frag. 15)Elapsed time

0:00:00.000193

Condition 1(Frag. 15)Rowsremainingaftercondition

7745

Condition 1(Frag. 15)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment16)

safcat.htm20test.htm20 BETWEEN [13469269098496 AND 13469269102591]

Condition 1(Frag. 16)Selectivity

0.00000000

Condition 1(Frag. 16)Usefulness

2.00000000

Condition 1(Frag. 16)Elapsed time

0:00:00.001500

Condition 1(Frag. 16)Rowsremainingaftercondition

7745

Condition 1(Frag. 16)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.50581 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment17)

safcat.htm20test.htm20 BETWEEN [14568529068032 AND 14568596176895]

Condition 1(Frag. 17)Selectivity

0.00078000

Condition 1(Frag. 17)Usefulness

8.99922000

Condition 1(Frag. 17)Distincts inRange

7799

Condition 1(Frag. 17)Elapsed time

0:00:00.011652

Condition 1(Frag. 17)Rowsremainingaftercondition

15545

Condition 1(Frag. 17)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.50581 HNG: 3.33333 HG: 0.339

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment18)

safcat.htm20test.htm20 BETWEEN [14568751366144 AND 14568751431679]

Condition 1(Frag. 18)Selectivity

0.00000040

Condition 1(Frag. 18)Usefulness

8.99999960

Condition 1(Frag. 18)Distincts inRange

4

Condition 1(Frag. 18)Elapsed time

0:00:00.005407

Condition 1(Frag. 18)Rowsremainingaftercondition

15549

Condition 1(Frag. 18)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment19)

safcat.htm20test.htm20 BETWEEN [14568751497216 AND 14568751562751]

Condition 1(Frag. 19)Selectivity

0.00000030

Condition 1(Frag. 19)Usefulness

8.99999970

Condition 1(Frag. 19)Distincts inRange

3

Condition 1(Frag. 19)Elapsed time

0:00:00.004413

Condition 1(Frag. 19)Rowsremainingaftercondition

15552

Condition 1(Frag. 19)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment20)

safcat.htm20test.htm20 BETWEEN [14568751579136 AND 14568751580159]

Condition 1(Frag. 20)Selectivity

0.00000000

Condition 1(Frag. 20)Usefulness

2.00000000

Condition 1(Frag. 20)Elapsed time

0:00:00.001220

Condition 1(Frag. 20)Rowsremainingaftercondition

15552

Condition 1(Frag. 20)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.51166 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment21)

safcat.htm20test.htm20 BETWEEN [14568751580672 AND 14568751580672]

Condition 1(Frag. 21)Selectivity

0.00000000

Condition 1(Frag. 21)Usefulness

2.00000000

Condition 1(Frag. 21)Elapsed time

0:00:00.000200

Condition 1(Frag. 21)Rowsremainingaftercondition

15552

Condition 1(Frag. 21)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment22)

safcat.htm20test.htm20 BETWEEN [14568751582720 AND 14568751582720]

Condition 1(Frag. 22)Selectivity

0.00000000

Condition 1(Frag. 22)Usefulness

2.00000000

Condition 1(Frag. 22)Elapsed time

0:00:00.000187

Condition 1(Frag. 22)Rowsremainingaftercondition

15552

Condition 1(Frag. 22)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment23)

safcat.htm20test.htm20 BETWEEN [14568751582722 AND 14568751582722]

Condition 1(Frag. 23)Selectivity

0.00000000

Condition 1(Frag. 23)Usefulness

2.00000000

Condition 1(Frag. 23)Elapsed time

0:00:00.000191

Condition 1(Frag. 23)Rowsremainingaftercondition

15552

Condition 1(Frag. 23)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment24)

safcat.htm20test.htm20 BETWEEN [14568751582723 AND 14568751582723]

Condition 1(Frag. 24)Selectivity

0.00000000

Condition 1(Frag. 24)Usefulness

2.00000000

Condition 1(Frag. 24)Elapsed time

0:00:00.000191

Condition 1(Frag. 24)Rowsremainingaftercondition

15552

Condition 1(Frag. 24)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment25)

safcat.htm20test.htm20 BETWEEN [14568772337664 AND 14568772403199]

Condition 1(Frag. 25)Selectivity

0.00000040

Condition 1(Frag. 25)Usefulness

8.99999960

Condition 1(Frag. 25)Distincts inRange

4

Condition 1(Frag. 25)Elapsed time

0:00:00.003212

Condition 1(Frag. 25)Rowsremainingaftercondition

15556

Condition 1(Frag. 25)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment26)

safcat.htm20test.htm20 BETWEEN [14568772403200 AND 14568772468735]

Condition 1(Frag. 26)Selectivity

0.00000070

Condition 1(Frag. 26)Usefulness

8.99999930

Condition 1(Frag. 26)Distincts inRange

7

Condition 1(Frag. 26)Elapsed time

0:00:00.004555

Condition 1(Frag. 26)Rowsremainingaftercondition

15563

Condition 1(Frag. 26)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment27)

safcat.htm20test.htm20 BETWEEN [14568772567040 AND 14568772568063]

Condition 1(Frag. 27)Selectivity

0.00000010

Condition 1(Frag. 27)Usefulness

9.99999990

Condition 1(Frag. 27)Distincts inRange

1

Condition 1(Frag. 27)Elapsed time

0:00:00.002755

Condition 1(Frag. 27)Rowsremainingaftercondition

15564

Condition 1(Frag. 27)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment28)

safcat.htm20test.htm20 BETWEEN [14568772569344 AND 14568772569344]

Condition 1(Frag. 28)Selectivity

0.00000000

Condition 1(Frag. 28)Usefulness

2.00000000

Condition 1(Frag. 28)Elapsed time

0:00:00.000216

Condition 1(Frag. 28)Rowsremainingaftercondition

15564

Condition 1(Frag. 28)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment29)

safcat.htm20test.htm20 BETWEEN [14568772570368 AND 14568772570368]

Condition 1(Frag. 29)Selectivity

0.00000000

Condition 1(Frag. 29)Usefulness

2.00000000

Condition 1(Frag. 29)Elapsed time

0:00:00.000195

Condition 1(Frag. 29)Rowsremainingaftercondition

15564

Condition 1(Frag. 29)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment30)

safcat.htm20test.htm20 BETWEEN [14568772570369 AND 14568772570369]

Condition 1(Frag. 30)Selectivity

0.00000000

Condition 1(Frag. 30)Usefulness

2.00000000

Condition 1(Frag. 30)Elapsed time

0:00:00.000185

Condition 1(Frag. 30)Rowsremainingaftercondition

15564

Condition 1(Frag. 30)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment31)

safcat.htm20test.htm20 BETWEEN [14568772570371 AND 14568772570371]

Condition 1(Frag. 31)Selectivity

0.00000000

Condition 1(Frag. 31)Usefulness

2.00000000

Condition 1(Frag. 31)Elapsed time

0:00:00.000186

Condition 1(Frag. 31)Rowsremainingaftercondition

15564

Condition 1(Frag. 31)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment32)

safcat.htm20test.htm20 BETWEEN [14568780726272 AND 14568780730367]

Condition 1(Frag. 32)Selectivity

0.00000000

Condition 1(Frag. 32)Usefulness

2.00000000

Condition 1(Frag. 32)Elapsed time

0:00:00.001325

Condition 1(Frag. 32)Rowsremainingaftercondition

15564

Condition 1(Frag. 32)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.51167 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment33)

safcat.htm20test.htm20 BETWEEN [15668040695808 AND 15668107804671]

Condition 1(Frag. 33)Selectivity

0.00078390

Condition 1(Frag. 33)Usefulness

8.99921610

Condition 1(Frag. 33)Distincts inRange

7838

Condition 1(Frag. 33)Elapsed time

0:00:00.011799

Condition 1(Frag. 33)Rowsremainingaftercondition

23403

Condition 1(Frag. 33)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.51167 HNG: 3.33333 HG: 0.339195

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment34)

safcat.htm20test.htm20 BETWEEN [15668262993920 AND 15668263059455]

Condition 1(Frag. 34)Selectivity

0.00000030

Condition 1(Frag. 34)Usefulness

8.99999970

Condition 1(Frag. 34)Distincts inRange

3

Condition 1(Frag. 34)Elapsed time

0:00:00.002850

Condition 1(Frag. 34)Rowsremainingaftercondition

23406

Condition 1(Frag. 34)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment35)

safcat.htm20test.htm20 BETWEEN [15668263124992 AND 15668263190527]

Condition 1(Frag. 35)Selectivity

0.00000050

Condition 1(Frag. 35)Usefulness

8.99999950

Condition 1(Frag. 35)Distincts inRange

5

Condition 1(Frag. 35)Elapsed time

0:00:00.004587

Condition 1(Frag. 35)Rowsremainingaftercondition

23411

Condition 1(Frag. 35)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment36)

safcat.htm20test.htm20 BETWEEN [15668263206912 AND 15668263207935]

Condition 1(Frag. 36)Selectivity

0.00000000

Condition 1(Frag. 36)Usefulness

2.00000000

Condition 1(Frag. 36)Elapsed time

0:00:00.001553

Condition 1(Frag. 36)Rowsremainingaftercondition

23411

Condition 1(Frag. 36)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.51756 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment37)

safcat.htm20test.htm20 BETWEEN [15668263208448 AND 15668263208448]

Condition 1(Frag. 37)Selectivity

0.00000000

Condition 1(Frag. 37)Usefulness

2.00000000

Condition 1(Frag. 37)Elapsed time

0:00:00.000211

Condition 1(Frag. 37)Rowsremainingaftercondition

23411

Condition 1(Frag. 37)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment38)

safcat.htm20test.htm20 BETWEEN [15668263210496 AND 15668263210496]

Condition 1(Frag. 38)Selectivity

0.00000000

Condition 1(Frag. 38)Usefulness

2.00000000

Condition 1(Frag. 38)Elapsed time

0:00:00.000188

Condition 1(Frag. 38)Rowsremainingaftercondition

23411

Condition 1(Frag. 38)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment39)

safcat.htm20test.htm20 BETWEEN [15668263210498 AND 15668263210498]

Condition 1(Frag. 39)Selectivity

0.00000000

Condition 1(Frag. 39)Usefulness

2.00000000

Condition 1(Frag. 39)Elapsed time

0:00:00.000190

Condition 1(Frag. 39)Rowsremainingaftercondition

23411

Condition 1(Frag. 39)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment40)

safcat.htm20test.htm20 BETWEEN [15668263210499 AND 15668263210499]

Condition 1(Frag. 40)Selectivity

0.00000000

Condition 1(Frag. 40)Usefulness

2.00000000

Condition 1(Frag. 40)Elapsed time

0:00:00.000188

Condition 1(Frag. 40)Rowsremainingaftercondition

23411

Condition 1(Frag. 40)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment41)

safcat.htm20test.htm20 BETWEEN [15668283965440 AND 15668284030975]

Condition 1(Frag. 41)Selectivity

0.00000030

Condition 1(Frag. 41)Usefulness

8.99999970

Condition 1(Frag. 41)Distincts inRange

3

Condition 1(Frag. 41)Elapsed time

0:00:00.005640

Condition 1(Frag. 41)Rowsremainingaftercondition

23414

Condition 1(Frag. 41)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment42)

safcat.htm20test.htm20 BETWEEN [15668284030976 AND 15668284096511]

Condition 1(Frag. 42)Selectivity

0.00000050

Condition 1(Frag. 42)Usefulness

8.99999950

Condition 1(Frag. 42)Distincts inRange

5

Condition 1(Frag. 42)Elapsed time

0:00:00.004619

Condition 1(Frag. 42)Rowsremainingaftercondition

23419

Condition 1(Frag. 42)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment43)

safcat.htm20test.htm20 BETWEEN [15668284194816 AND 15668284195839]

Condition 1(Frag. 43)Selectivity

0.00000000

Condition 1(Frag. 43)Usefulness

2.00000000

Condition 1(Frag. 43)Elapsed time

0:00:00.001355

Condition 1(Frag. 43)Rowsremainingaftercondition

23419

Condition 1(Frag. 43)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.51756 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

3

Condition 1(Fragment44)

safcat.htm20test.htm20 BETWEEN [15668284197120 AND 15668284197120]

Condition 1(Frag. 44)Selectivity

0.00000000

Condition 1(Frag. 44)Usefulness

2.00000000

Condition 1(Frag. 44)Elapsed time

0:00:00.000201

Condition 1(Frag. 44)Rowsremainingaftercondition

23419

Condition 1(Frag. 44)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment45)

safcat.htm20test.htm20 BETWEEN [15668284198144 AND 15668284198144]

Condition 1(Frag. 45)Selectivity

0.00000000

Condition 1(Frag. 45)Usefulness

2.00000000

Condition 1(Frag. 45)Elapsed time

0:00:00.000189

Condition 1(Frag. 45)Rowsremainingaftercondition

23419

Condition 1(Frag. 45)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment46)

safcat.htm20test.htm20 BETWEEN [15668284198145 AND 15668284198145]

Condition 1(Frag. 46)Selectivity

0.00000000

Condition 1(Frag. 46)Usefulness

2.00000000

Condition 1(Frag. 46)Elapsed time

0:00:00.000187

Condition 1(Frag. 46)Rowsremainingaftercondition

23419

Condition 1(Frag. 46)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment47)

safcat.htm20test.htm20 BETWEEN [15668284198147 AND 15668284198147]

Condition 1(Frag. 47)Selectivity

0.00000000

Condition 1(Frag. 47)Usefulness

2.00000000

Condition 1(Frag. 47)Elapsed time

0:00:00.000378

Condition 1(Frag. 47)Rowsremainingaftercondition

23419

Condition 1(Frag. 47)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment48)

safcat.htm20test.htm20 BETWEEN [15668292354048 AND 15668292358143]

Condition 1(Frag. 48)Selectivity

0.00000000

Condition 1(Frag. 48)Usefulness

2.00000000

Condition 1(Frag. 48)Elapsed time

0:00:00.001576

Condition 1(Frag. 48)Rowsremainingaftercondition

23419

Condition 1(Frag. 48)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.51756 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment49)

safcat.htm20test.htm20 BETWEEN [16767552323584 AND 16767619432447]

Condition 1(Frag. 49)Selectivity

0.00078380

Condition 1(Frag. 49)Usefulness

8.99921620

Condition 1(Frag. 49)Distincts inRange

7836

Condition 1(Frag. 49)Elapsed time

0:00:00.014825

Condition 1(Frag. 49)Rowsremainingaftercondition

31257

Condition 1(Frag. 49)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.51756 HNG: 3.33333 HG: 0.33919

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment50)

safcat.htm20test.htm20 BETWEEN [16767774621696 AND 16767774687231]

Condition 1(Frag. 50)Selectivity

0.00000090

Condition 1(Frag. 50)Usefulness

8.99999910

Condition 1(Frag. 50)Distincts inRange

9

Condition 1(Frag. 50)Elapsed time

0:00:00.004232

Condition 1(Frag. 50)Rowsremainingaftercondition

31266

Condition 1(Frag. 50)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment51)

safcat.htm20test.htm20 BETWEEN [16767774752768 AND 16767774818303]

Condition 1(Frag. 51)Selectivity

0.00000040

Condition 1(Frag. 51)Usefulness

8.99999960

Condition 1(Frag. 51)Distincts inRange

4

Condition 1(Frag. 51)Elapsed time

0:00:00.004116

Condition 1(Frag. 51)Rowsremainingaftercondition

31270

Condition 1(Frag. 51)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment52)

safcat.htm20test.htm20 BETWEEN [16767774834688 AND 16767774835711]

Condition 1(Frag. 52)Selectivity

0.00000000

Condition 1(Frag. 52)Usefulness

2.00000000

Condition 1(Frag. 52)Elapsed time

0:00:00.001378

Condition 1(Frag. 52)Rowsremainingaftercondition

31270

Condition 1(Frag. 52)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.52345 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment53)

safcat.htm20test.htm20 BETWEEN [16767774836224 AND 16767774836224]

Condition 1(Frag. 53)Selectivity

0.00000000

Condition 1(Frag. 53)Usefulness

2.00000000

Condition 1(Frag. 53)Elapsed time

0:00:00.000201

Condition 1(Frag. 53)Rowsremainingaftercondition

31270

Condition 1(Frag. 53)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment54)

safcat.htm20test.htm20 BETWEEN [16767774838272 AND 16767774838272]

Condition 1(Frag. 54)Selectivity

0.00000000

Condition 1(Frag. 54)Usefulness

2.00000000

Condition 1(Frag. 54)Elapsed time

0:00:00.000193

Condition 1(Frag. 54)Rowsremainingaftercondition

31270

Condition 1(Frag. 54)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment55)

safcat.htm20test.htm20 BETWEEN [16767774838274 AND 16767774838274]

Condition 1(Frag. 55)Selectivity

0.00000000

Condition 1(Frag. 55)Usefulness

2.00000000

Condition 1(Frag. 55)Elapsed time

0:00:00.000187

Condition 1(Frag. 55)Rowsremainingaftercondition

31270

Condition 1(Frag. 55)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment56)

safcat.htm20test.htm20 BETWEEN [16767774838275 AND 16767774838275]

Condition 1(Frag. 56)Selectivity

0.00000000

Condition 1(Frag. 56)Usefulness

2.00000000

Condition 1(Frag. 56)Elapsed time

0:00:00.000193

Condition 1(Frag. 56)Rowsremainingaftercondition

31270

Condition 1(Frag. 56)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment57)

safcat.htm20test.htm20 BETWEEN [16767795593216 AND 16767795658751]

Condition 1(Frag. 57)Selectivity

0.00000090

Condition 1(Frag. 57)Usefulness

8.99999910

Condition 1(Frag. 57)Distincts inRange

9

Condition 1(Frag. 57)Elapsed time

0:00:00.004166

Condition 1(Frag. 57)Rowsremainingaftercondition

31279

Condition 1(Frag. 57)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment58)

safcat.htm20test.htm20 BETWEEN [16767795658752 AND 16767795724287]

Condition 1(Frag. 58)Selectivity

0.00000060

Condition 1(Frag. 58)Usefulness

8.99999940

Condition 1(Frag. 58)Distincts inRange

6

Condition 1(Frag. 58)Elapsed time

0:00:00.003896

Condition 1(Frag. 58)Rowsremainingaftercondition

31285

Condition 1(Frag. 58)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment59)

safcat.htm20test.htm20 BETWEEN [16767795822592 AND 16767795823615]

Condition 1(Frag. 59)Selectivity

0.00000000

Condition 1(Frag. 59)Usefulness

2.00000000

Condition 1(Frag. 59)Elapsed time

0:00:00.001399

Condition 1(Frag. 59)Rowsremainingaftercondition

31285

Condition 1(Frag. 59)Index

HG safcat.htm20test.htm20_hg

Condition 1range cost FP: 2.52346 HNG: 3.33333 HG: 0.3

Condition 1Number ofThreadsUsed

2

Condition 1(Fragment60)

safcat.htm20test.htm20 BETWEEN [16767795824896 AND 16767795824896]

Condition 1(Frag. 60)Selectivity

0.00000000

Condition 1(Frag. 60)Usefulness

2.00000000

Condition 1(Frag. 60)Elapsed time

0:00:00.000203

Condition 1(Frag. 60)Rowsremainingaftercondition

31285

Condition 1(Frag. 60)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment61)

safcat.htm20test.htm20 BETWEEN [16767795825920 AND 16767795825920]

Condition 1(Frag. 61)Selectivity

0.00000000

Condition 1(Frag. 61)Usefulness

2.00000000

Condition 1(Frag. 61)Elapsed time

0:00:00.000199

Condition 1(Frag. 61)Rowsremainingaftercondition

31285

Condition 1(Frag. 61)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment62)

safcat.htm20test.htm20 BETWEEN [16767795825921 AND 16767795825921]

Condition 1(Frag. 62)Selectivity

0.00000000

Condition 1(Frag. 62)Usefulness

2.00000000

Condition 1(Frag. 62)Elapsed time

0:00:00.000188

Condition 1(Frag. 62)Rowsremainingaftercondition

31285

Condition 1(Frag. 62)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment63)

safcat.htm20test.htm20 BETWEEN [16767795825923 AND 16767795825923]

Condition 1(Frag. 63)Selectivity

0.00000000

Condition 1(Frag. 63)Usefulness

2.00000000

Condition 1(Frag. 63)Elapsed time

0:00:00.000206

Condition 1(Frag. 63)Rowsremainingaftercondition

31285

Condition 1(Frag. 63)Index

HG safcat.htm20test.htm20_hg

Condition 1(Fragment64)

safcat.htm20test.htm20 BETWEEN [16767803981824 AND 16767803985919]

Condition 1(Frag. 64)Selectivity

0.00000020

Condition 1(Frag. 64)Usefulness

8.99999980

Condition 1(Frag. 64)Distincts inRange

2

Condition 1(Frag. 64)Elapsed time

0:00:00.003415

Condition 1(Frag. 64)Rowsremainingaftercondition

31287

Condition 1(Frag. 64)Index

HG safcat.htm20test.htm20_hg

Condition 1Note HG index selected due to index cutoff heuristic

Condition 1Number ofThreadsUsed

2

OutputVector 1 entries (8 data bytes)

Output 1 COUNT(safcat.htm20test.row_id)Output 1Data Type unsigned bigint (20, 0)

Output 1BaseDistincts

1

Output 1SFS Index FP safcat.htm20test.ASIQ_IDX_T733_C2_FP

Output 1SFS Tally 0

Output 1 LFSIndex FP safcat.htm20test.ASIQ_IDX_T733_C2_FP

Output 1 LFSTally 1

Column 1 safcat.htm20test.htm20Column 1Data Type bigint (19, 0)

Column 1BaseDistincts

9999977

Column 1Est. FilteredDistincts

31287

Column 1Note HG index used by optimizer

Column 1Indexes FP, HG

Column 2 safcat.htm20test.row_idColumn 2Data Type bigint (19, 0)

Column 2BaseDistincts(Est.)

48978

Column 2Est. FilteredDistincts

31287

Column 2Indexes FP

MaximumRow ID 10000000

HTMQUERY PLAN

Page 74: VO Course 11: Spatial indexing

References & LinksHEALPix: A Framework for High-Resolution Discretization and Fast Analysis […]

HEALPix Primer

Spatial indexing in a relational database using HEALPix

Mapping on the HEALPix grid

Indexing the Sphere with the Hierarchical Triangular Mesh

Splitting the sky - HTM & HEALPix

Q3C, Quad Tree Cube - The new sky-indexing concept

pgSphere documentation