ADL_query_translator modules/paradigms/Spatial_BoxCoordinatesNoCrossing_0_360.py

modules / paradigms / Spatial_BoxCoordinatesNoCrossing_0_360.py 


 SYNOPSIS

     Spatial_BoxCoordinatesNoCrossing_0_360 (table, idColumn, northColumn,
         southColumn, eastColumn, westColumn, cardinality)

         table
             A table to query, e.g., "holding".

         idColumn
             The table's object identifier column (i.e., the column
             to be selected), e.g., "holding_id".

         northColumn
         southColumn
         eastColumn
         westColumn
             The table columns that hold the indicated bounding
             coordinates, e.g., "north", "south", etc.

         cardinality
             A Cardinality object representing the cardinality of
             'table' with respect to the coordinate columns.

 DESCRIPTION

     Translates a box spatial constraint to a boolean combination of
     one or more SQL numeric comparisons assuming that object
     footprints are boxes described by four bounding coordinates.

     NOTE: this paradigm is identical to
     'Spatial_BoxCoordinatesNoCrossing', except that here we expect
     'eastColumn' and 'westColumn' to be in the range [0,360].

     Typically this paradigm will produce four ANDed numeric
     comparisons.  For example, the constraint:

         
           adl:geographic-locations
           overlaps
           
             45
             35
             -120
             -155
           
         

     is translated to:

         SELECT identifier FROM table
             WHERE south <= 45.0 AND north >= 35.0 AND
                 west <= 240.0 AND east >= 205.0

     But in boundary cases the query may take on other forms.  For
     example, the constraint:

         
           adl:geographic-locations
           overlaps
           
             90
             35
             120
             0
           
         

     is translated to:

         SELECT identifier FROM table
             WHERE (north >= 35.0 AND (west <= 120.0 OR east = 360.0))
                 OR south = 90.0

     Formally, a box is the region formed by the intersection of four
     graticule-aligned half-spaces: a northernmost and southernmost
     latitude (each expressed in degrees north of the equator and in
     the range [-90,90]); and an easternmost and westernmost
     longitude (each expressed in degrees east of the Greenwich
     meridian, with query region longitudes in the range [-180,180]
     and object footprint longitudes in the range [0,360]).  The
     northernmost latitude must be greater than or equal to the
     southernmost.  The westernmost longitude of a query region may
     be greater than the easternmost, in which case a box that
     crosses the +/-180 meridian is described.  As a special case, a
     query region (object footprint) that spans all longitudes is
     described by a westernmost longitude of -180 (0) and an
     easternmost of 180 (360).

     NOTE: this paradigm assumes that NO object footprint crosses the
     0/360 meridian.  However, query regions that cross the +/-180
     meridian are allowed and are handled correctly, as are all
     discontinuities involving the poles.

     The semantics of the "contains" and "is-contained-in" operators
     will generally be correct only if the cardinality is "1" or
     "1?".  The "0+" and "1+" cardinalities should be used with this
     paradigm only if objects truly have multiple, equivalent
     footprints.  In particular, this paradigm does not support
     footprints that are unions of multiple boxes.

     Exceptions thrown:

         polygonal query regions not supported

 AUTHOR

     Greg Janee
     gjanee@alexandria.ucsb.edu

 HISTORY

     $Log: Spatial_BoxCoordinatesNoCrossing_0_360.py,v $
     Revision 1.2  2003/04/16 18:32:10  valentin
     updated to latest translator code

     Revision 1.3  2003/01/29 19:06:37  gjanee
     Recoded slightly to take advantage of new paradigm convenience
     functions.

     Revision 1.2  2003/01/24 17:47:26  gjanee
     Added support for NULL footprint columns.  Specifically, if the
     footprint columns may be NULL (we tacitly assume that the four
     columns are either all NULL or all non-NULL) then the constant
     TRUE is changed from "SELECT idColumn FROM table WHERE 1 = 1" to
     "SELECT idColumn FROM table WHERE northColumn IS NOT NULL".

     Revision 1.1  2002/11/05 23:46:47  gjanee
     Initial revision

Imported Modules   

import UniversalTranslator
import edu.ucsb.adl.middleware
import types

Classes   

Spatial_BoxCoordinatesNoCrossing_0_360


This document was automatically generated Thu Mar 4 12:45:22 2004 by HappyDoc version WORKING