ADL_query_translator modules/paradigms/Spatial_BoxCoordinatesNoCrossing.py

modules / paradigms / Spatial_BoxCoordinatesNoCrossing.py 


 SYNOPSIS

     Spatial_BoxCoordinatesNoCrossing (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.

     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 <= -120.0 AND east >= -155.0

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

         
           adl:geographic-locations
           overlaps
           
             90
             35
             -120
             -180
           
         

     is translated to:

         SELECT identifier FROM table
             WHERE (north >= 35.0 AND (west <= -120.0 OR east = 180.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 and in the range [-180,180]).  The northernmost
     latitude must be greater than or equal to the southernmost.  The
     westernmost longitude may be greater than the easternmost, in
     which case a box that crosses the +/-180 meridian is described.
     As a special case, the set of all longitudes is described by a
     westernmost longitude of -180 and an easternmost of 180.

     NOTE: this paradigm assumes that NO object footprint crosses the
     +/-180 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.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:36:45  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/10/30 06:58:51  gjanee
     Initial revision

Imported Modules   

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

Classes   

Spatial_BoxCoordinatesNoCrossing


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