Changeset 8392 for mauRepo


Ignore:
Timestamp:
25/06/12 13:28:21 (7 years ago)
Author:
mnagni
Message:

Incomplete - # 22488: CEDA Observation Collection - Geographical Extent
 http://team.ceda.ac.uk/trac/ceda/ticket/22488

Location:
mauRepo/MolesManager/trunk/src
Files:
1 added
2 edited

Legend:

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

    r8387 r8392  
    4545from ea_model.moles3_4.utilities.mo_rolevalue import MO_RoleValue 
    4646from sqlalchemy.orm.collections import InstrumentedList 
     47from ea_model.iso_19115_2006_metadata_corrigendum.extent_information.ex_geographicboundingbox import EX_GeographicBoundingBox 
     48from libs.postgisutil import unifyGeometries, create_st_setSRID 
    4749 
    4850 
     
    148150        return coll                                       
    149151 
     152    def getGeograpicExtentGeometry(self, ge): 
     153        ''' 
     154            Creates the appropriate postgis geometry from a EX_GeographicExtent 
     155            @param ge: an EX_GeographicExtent instance 
     156            @return: a postgix text geometry 
     157        ''' 
     158        if isinstance(ge, EX_GeographicBoundingBox): 
     159            return create_st_setSRID(ge.westBoundLongitude, ge.southBoundLatitude, \ 
     160                           ge.eastBoundLongitude, ge.northBoundLatitude) 
     161        return None 
     162     
     163     
     164     
     165    def getUnifyObservationCollectionGE(self, collection): 
     166        """ 
     167            Returns the union of the collections.member'a  GeographicExtension(s) 
     168            @param collection: an CEDA_ObservationColleciton instance   
     169        """ 
     170        bboxes = [] 
     171        for member in collection.member: 
     172            for ge in member.geographicExtent: 
     173                bboxes.append(self.getGeograpicExtentGeometry(ge)) 
     174         
     175        return unifyGeometries(bboxes, self)   
     176 
    150177    def retrieveGUIDFromInstance(self, instance): 
    151178        """ 
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/dataEntity.py

    r8391 r8392  
    6868        self._dataEntityHasSameHash = hasMOSameHash(self._dataEntityMigration)        
    6969        self.epbRepo = epbRepo 
     70 
     71    def _checkGeographicExtent(self, ceda_observationCollection): 
     72        union = self.moles3epb.getUnifyObservationCollectionGE(ceda_observationCollection) 
    7073     
    7174    def _processTitle(self, ceda_observationCollection): 
     
    206209                                       
    207210            except Exception as ex: 
    208                 exs.append(ex)   
     211                exs.append(ex) 
     212                 
     213        self._checkGeographicExtent(obsColl) 
     214           
    209215        return exs 
Note: See TracChangeset for help on using the changeset viewer.