Ignore:
Timestamp:
15/12/09 13:53:37 (10 years ago)
Author:
domlowe
Message:

xlinks now resolved for all aspects of the domain.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cows/trunk/cows/service/imps/csmlbackend/wfs_csmllayer.py

    r5916 r6138  
    1818from shapely.geometry import Polygon, Point 
    1919from cows.bbox_util import union 
     20from csml.csmllibs.csmlextra import listify, stringify, cleanString2 
    2021 
    2122import logging 
     
    257258            log.debug('there is a problem getting the bounding box for feature id %s'%self._feature.id) 
    258259            self.wgs84BBox=() 
     260     
     261    def _fixXlinks(self): 
     262        ''' replaces xlinks in feature domain with inline content''' 
     263        for att in ['gridSeriesDomain', 'pointDomain', 'profileSeriesDomain','sectionDomain','trajectoryDomain']: 
     264            if hasattr(self._feature.value, att): 
     265                domain=getattr(self._feature.value,att) 
     266                for ordinate in listify(domain.coordTransformTable.gridOrdinates): 
     267                    #insertedExtract is the 'hidden' resolved xlink data, expose inline 
     268                    if hasattr(ordinate.coordAxisValues, 'insertedExtract'): 
     269                        ordinate.coordAxisValues.CONTENT=cleanString2(str(ordinate.coordAxisValues.insertedExtract.getData()[0].tolist()))                             
     270     
    259271    def toGML(self): 
    260272        """ Create a GML (CSML) representation of the feature """ 
     
    262274        qualifiedFeatureType='{http://ndg.nerc.ac.uk/csml}' + nonamespaceFType 
    263275        emptyelem=etree.Element(qualifiedFeatureType) 
     276        #modify self._feature so that any references to xlinks are replaced with inline content 
     277        self._fixXlinks()         
    264278        csmlelem=self._feature.toXML(emptyelem) 
    265279        return etree.tostring(csmlelem) 
Note: See TracChangeset for help on using the changeset viewer.