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

Tom McGlynn Thomas.A.McGlynn at nasa.gov
Mon Oct 26 06:58:51 PDT 2009


Patrick Dowler wrote:

> Note that postgresql+pg_sphere has the same limitations (except sbox, so have 
> to use spoly directly); I also found that both STC-S and pg_sphere are limited 
> to simple polygons and do not support unions of disjoint regions or holes 
> inside polygons.

Hi Pat,

Could you expand on this?  That's not surprising for PgSphere which 
doesn't purport to do anything more than circles and polygons (and its 
boxes in a limited way), but I had understood that REGION's could be 
quite complex.  Is that not the case?

If one has a database with a complex FOV metadata then presumably one 
could describe it using a constraint fragment like

     contains(spec1,pointxy)=1 and contains(spec2,pointxy)=1 and
     contains(spec3,pointxy)=0

to describe a union of spec1 and spec2 excluding spec3.  Here spec1, 
spec2 and spec3 might be BOX or CIRCLE or REGION specifications. 
However this seems to require some custom syntax (e.g., the pointxy) I 
thought that's what REGION itself was supposed to do but I gather that 
STC-S is rather more restricted.

I had been thinking of using  PgSphere like:

    create type geom (
        type     int,
        spec     text,
        polygon  spoly,
        circle   scirc,
        region   adql_region)


    create type adql_reqion (
        fields   geom[],
        ops      int,
     )

where the geom object is a 'superclass' of all of the geometry
classes.  The type field indicates which class will be populated in
a given instance.

The adql_region type comprises an array of geometry objects with an 
operation code for each.  The elements of the geom array build up the 
region using as a kind of reverse polish stack of union, intersection, 
not and store operations.  I haven't thought through how this 
description could then be used to implement a contains or intersects 
operations.  [And now that I've started, I'm not sure it would work.]

I think I still need the first type, but from your comments it sounds 
like any REGION currently specifiable can be represented as a single 
polygon.  Is that right?


	Tom

  However, our metadata (observation FOV) does have polygons
> with disjoint shapes and holes, so I have to figure out how to deal with 
> that...
> 
> 



More information about the dal mailing list