Changeset 8470


Ignore:
Timestamp:
13/07/12 10:30:15 (7 years ago)
Author:
mnagni
Message:

Checked and fixed a bug on the geographicExtent parameter query

Location:
mauRepo/HPFos/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/HPFos/trunk/src/HPFos/moles3epb.py

    r8466 r8470  
    131131                collection_geometry = getGeograpicExtentGeometry(collection.geographicExtent[0]) 
    132132                if collection_geometry is not None \ 
    133                         and intersectGeometries([collection_geometry, bbox], self): 
     133                        and intersectGeometries(bbox, collection_geometry, self): 
    134134                    res.append(self.searchSelectiveLoad(CEDA_ObservationCollection, \ 
    135135                            collection.id, ['geographicExtent.*'])) 
  • mauRepo/HPFos/trunk/src/libs/postgisutil.py

    r8354 r8470  
    5050        @return: Returns a postgis string describing a BOX3D using EPSG:4326 decimal degree 
    5151    ''' 
    52     return 'st_setSRID(\'BOX3D(%d %d, %d %d)\'::box3d, %d)' \ 
     52    return 'st_setSRID(\'BOX(%d %d, %d %d)\'::box2d, %d)' \ 
    5353        % (west, south, east, north, srid) 
    5454 
     
    5656    return _processGeometries(bboxes, epb, 'ST_Union') 
    5757 
    58 def intersectGeometries(bboxes, epb): 
    59     return _processGeometries(bboxes, epb, 'ST_Intersection') 
     58def intersectGeometries(first_bbox, second_bbox, epb): 
     59    ''' 
     60        Compares if two bboxes instersect one another 
     61        @param first_bbox: the first bbox 
     62        @param second_bbox: the second bbox        
     63        @param epb: a 'executeNative' enabled EPB 
     64        @return: a string representing the union or None if invalid or a POINT    
     65    '''     
     66    if first_bbox is None or second_bbox is None: 
     67        return None 
     68            
     69    intersectCmd = 'SELECT ST_AsText(%s(%s,%s));' % ('ST_Intersection', first_bbox, second_bbox) 
     70    ilogging.debug(intersectCmd)                 
     71    res = normalizeUnicode(epb.executeNative(intersectCmd).first()[0]) 
     72    return not res == 'GEOMETRYCOLLECTION EMPTY' 
    6073         
    6174def _processGeometries(bboxes, epb, function): 
Note: See TracChangeset for help on using the changeset viewer.