Пример #1
0
    def describe_xml(self):
        doc = E.Output(OWS.Identifier(self.identifier), OWS.Title(self.title))

        if self.abstract:
            doc.append(OWS.Abstract(self.abstract))

        for m in self.metadata:
            doc.append(OWS.Metadata(m))

        literal_data_doc = E.LiteralOutput()

        if self.data_type:
            data_type = OWS.DataType(self.data_type)
            data_type.attrib['{%s}reference' %
                             NAMESPACES['ows']] = OGCTYPE[self.data_type]
            literal_data_doc.append(data_type)

        if self.uoms:
            default_uom_element = self.uom.describe_xml()
            supported_uom_elements = [u.describe_xml() for u in self.uoms]

            literal_data_doc.append(
                E.UOMs(E.Default(default_uom_element),
                       E.Supported(*supported_uom_elements)))

        doc.append(literal_data_doc)

        return doc
Пример #2
0
    def describe_xml(self):
        """Return DescribeProcess Output element
        """
        doc = E.Input(
            OWS.Identifier(self.identifier),
            OWS.Title(self.title)
        )

        doc.attrib['minOccurs'] = str(self.min_occurs)
        doc.attrib['maxOccurs'] = str(self.max_occurs)

        if self.abstract:
            doc.append(OWS.Abstract(self.abstract))

        if self.keywords:
            kws = map(OWS.Keyword, self.keywords)
            doc.append(OWS.Keywords(*kws))

        for m in self.metadata:
            doc.append(OWS.Metadata(dict(m)))

        literal_data_doc = E.LiteralData()

        if self.data_type:
            data_type = OWS.DataType(self.data_type)
            data_type.attrib['{%s}reference' %
                             NAMESPACES['ows']] = OGCTYPE[self.data_type]
            literal_data_doc.append(data_type)

        if self.uoms:
            default_uom_element = self.uoms[0].describe_xml()
            supported_uom_elements = [u.describe_xml() for u in self.uoms]

            literal_data_doc.append(
                E.UOMs(
                    E.Default(default_uom_element),
                    E.Supported(*supported_uom_elements)
                )
            )

        doc.append(literal_data_doc)

        # TODO: refer to table 29 and 30
        if self.any_value:
            literal_data_doc.append(OWS.AnyValue())
        else:
            literal_data_doc.append(self._describe_xml_allowedvalues())

        # TODO: is default value handled correctly here?
        if self.data:
            literal_data_doc.append(E.DefaultValue(str(self.data)))

        return doc
Пример #3
0
    def describe_xml(self):
        """Return DescribeProcess Output element
        """
        doc = E.Input(OWS.Identifier(self.identifier), OWS.Title(self.title))

        doc.attrib['minOccurs'] = str(self.min_occurs)
        doc.attrib['maxOccurs'] = str(self.max_occurs)

        if self.abstract:
            doc.append(OWS.Abstract(self.abstract))

        if self.metadata:
            doc.append(OWS.Metadata(*self.metadata))

        literal_data_doc = E.LiteralData()

        if self.data_type:
            data_type = OWS.DataType(self.data_type)
            data_type.attrib['{%s}reference' %
                             NAMESPACES['ows']] = OGCTYPE[self.data_type]
            literal_data_doc.append(data_type)

        if self.uoms:
            default_uom_element = self.uoms[0].describe_xml()
            supported_uom_elements = [u.describe_xml() for u in self.uoms]

            literal_data_doc.append(
                E.UOMs(E.Default(default_uom_element),
                       E.Supported(*supported_uom_elements)))

        doc.append(literal_data_doc)

        # TODO: refer to table 29 and 30
        literal_data_doc.append(OWS.AnyValue())

        if self.default:
            doc.append(E.DefaultValue(self.default))

        return doc