source: TI02-CSML/trunk/parser/API/CSMLDocument.py @ 1041

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/parser/API/CSMLDocument.py@1041
Revision 1041, 1006 bytes checked in by domlowe, 14 years ago (diff)

Added class to create new csml document

Line 
1''' CSMLDocument.py - simple implementation to return a CSML document containing a single type of feature'''
2
3class CSMLDocument:
4    def makeGridSeries(self,domain,rangeSet,datasetID=None,featureID=None):
5        fms=[] #empty featureMembers list
6        dset=Dataset()
7        feat=GridSeriesFeature()
8        if featureID:
9            feat.id= featureID
10        else:
11            feat.id='testfeature'
12        feat.description=Description('???')
13        feat.domain=domain
14        feat.rangeSet=rangeSet
15        fms.append(feat)
16        fc=FeatureCollection(members=fms)
17        #Create an Empty Dataset
18        ds = Dataset()
19        #Set objects as attributes of dataset
20        if datasetID:
21            ds.id=datasetID
22        else:
23            ds.id='testdataset'
24        ds.featureCollection=fc
25        #call the toXML method of the Dataset object:
26        csml = ds.toXML()
27        strCSML=parser_extra.PrettyPrint(csml)
28        strCSML=parser_extra.removeInlineNS(strCSML)
29        return strCSML
Note: See TracBrowser for help on using the repository browser.