Boxes and Polygons in ADQL/STC. Questions and recommendation.

Tom McGlynn Thomas.A.McGlynn at nasa.gov
Fri Oct 23 11:25:22 PDT 2009


In trying to implement the geometry elements of ADQL, I was a bit 
surprised when I finally read the definition of Box carefully.  I had 
assumed that it corresponded to a range in both coordinates.   That's 
what the PgSphere Box is.   However an ADQL box is a polygon, so it's
sides are all great circles.  If I've read this and done my geometry 
properly then, e.g.,  an ADQL box with a size of 180 degrees on both 
sides is in fact the hemisphere centered on the center of the box, i.e., 
a box and a circle are the same for that radius.  The area of the box is 
independent of the center of the box and depends only on the width fields.

For small boxes, where spherical distortions and projections can be 
ignored, this definition of  a box might be a reasonable approximation 
to the field of view of an observation.  Still, since an ADQL box must 
be aligned with the coordinate axes, it's not really general enough for 
that kind of use.  It needs a positional angle or some such.  I guess 
one might hack the coordinate system element to address this, but I 
don't think that's appropriate.

So my question is: What is a box intended to be used for?

My comment is that I think it would be good if and when the ADQL 
document is revised to explicitly note that a box does not correspond to 
  a set of ranges in the coordinates since I suspect that others may, as 
I did, assume that meaning.

	Tom McGlynn

P.S., If I may be permitted a second question. Given that a box is 
special case of polygon, then can I transform from one to the other?
E.g., given a box at (a,b) with widths (c,d), what are the coordinates
of the corners of the box.

P.P.S.,  This points out an ambiguity in the definition of polygons in 
ADQL.  The definition requires only the vertices of the polygon, to 
create a boundary the divides the sphere into two regions.  However it 
doesn't say which of the two regions is 'inside'.  This is fairly clear
in the plane, where one region is always finite and the other always 
infinite.  For large regions on the sphere there is no such obvious way 
to distinguish regions.  E.g., consider the polygon:

     POLYGON('ICRS GEOCENTER', 0,0,  120,0, 240,0)

This is a 'triangle' consisting of three 120 degree segments of the 
equator.  Does it include the northern or southern hemisphere?

I don't see any obvious resolution to this issue -- maybe allow a 
specification of a point that is inside the polygon?



More information about the dal mailing list