H3C HEALPix library for PostgreSQL  (version 1.2)
SQL functions
DESCRIPTION OF THE H3C FUNCTIONS
-------------------------------------------------------------------------------
Note: argument given in [..] are optional
-------------------------------------------------------------------------------
h3c_ang2ipix(ra, de [, nside])
RETURN the HELPix number from a position
h3c_ipix2ang(ipix [,nside])
RETURN the center of the HEALPix cell
-------------------------------------------------------------------------------
h3c_join(ra1, de1, ra2, de2, radius [,nside])
join 2 tables according to their positions
RETURN True if position match, else False
Ex: SELECT count(*) FROM table1, table2
WHERE h3c_join(table1.ra, table1.de, table2.ra, table2.de)
Note: The order of the parameters in the h3c_join function is important:
the first columns should be the smallest table
h3c_join_symetric(ra1, de1, ra2, de2, radius [,nside])
join 2 tables according to their positions
RETURN True if position match, else False
Ex: SELECT count(*) FROM table1, table2
WHERE h3c_join_symetric(table1.ra, table1.de, table2.ra, table2.de)
Note: at the opposite of h3c_join, the parameter order is not important.
h3c_radial_query(ra1, de1, ra0, de0, radius [,nside])
make a cone search arround position (ra0, de0)
RETURN True/False if position (ra,de) is in the circle
Ex: SELECT ra,de FROM table WHERE h3c_radial_query(ra,de,0,0,2/60.);
-------------------------------------------------------------------------------
h3c_in_poly(ra, de, Array())
RETURN True if (ra,de) is in the polygon
Ex: SELECT h3c_in_poly(0,0,Array[-1,-1,1,-1,1,1,-1,1]) ;
h3c_in_poly_convex(ra, de, Array())
RETURN True if (ra,de) is in the polygon
(works with convex polygon only)
Note: don't exist with Q3C
h3c_poly_query(ra, de, Array() [, nside])
RETURN True if (ra,de) is in a polygon (available for convex only)
Ex: SELECT ra,de FROM table
WHERE h3c_poly_query(ra,de,Array[10,10,11,10,11,11]);
h3c_poly_center(Array())
RETURN the center of the polygon
Ex: SELECT h3c_poly_center(Array[-1,-1,1,-1,1,1,-1,1]) ;
Note: don't exist with Q3C
h3c_circle_intersect_poly (double precision, double precision, double precision, double precision[])
RETURN True if circle intersects a vertex of the polygon
(available for convex only)
Ex: SELECT h3c_circle_intersect_poly(0,0,1,Array[-1,-1,1,-1,1,1]);
Note: the function doesn't use index
Note: don't exist with Q3C
h3c_poly_intersect_poly(double precision[], double precision[])
RETURN True if the first polygon intersect the second polygon
Ex: SELECT h3c_poly_intersect_poly(Array[0,0,9,0,2,2],
Array[10,10,11,10,11,11]);
Note: the function doesn't use index
Note: don't exist with Q3C
h3c_box_to_poly(ra0 ,de0, lon, lat)
RETURN an array (Array[ra0,de0,ra1,de1,ra2,de2,ra3,de3]) of 4 points
describing the box.
Ex: SELECT h3c_box_to_poly(0,0,1,2)
Note: don't exist with Q3C
h3c_poly_convex_query(ra, de, Array() [, nside])
see h3c_poly_query
-------------------------------------------------------------------------------
h3c_in_ellipse(ra, de, ra0, de0, may_ax, axis_ratio, position_angle)
RETURN if (ra, de) is in the ellipse
Ex: SELECT h3c_in_ellipse(-10,-10,0,0,1,1,0) ;
Note: the function doesn't use index
-------------------------------------------------------------------------------
h3c_dist(ra1, de1, ra2, de2)
RETURN the distance between 2 points (ra1, de1), (ra2, de2)
h3c_dist_ipix(ipix, ipix)
RETURN the distance between the center of 2 HEALpix cell
(in the default nside)
Note: don't exist with Q3C
h3c_circle_area(radius)
RETURN the are of a circle
Note: don't exist with Q3C
h3c_poly_area(Array())
RETURN the are of a polygon
Note: don't exist with Q3C
-------------------------------------------------------------------------------
h3c_ipix_query(ra, de, ipix, nside)
RETURN TRUE if (ra,de) is in the ipix (in igiven nside)
the function use the indexation!
Ex: Select count(*) FROM table WHERE h3c_ipix_query(ra, de, 100, 512)
-------------------------------------------------------------------------------
Notes: install the function with using h3c.sql.in