Beispiel #1
0
 def _genkml(self, format=True):
     """Returns the kml as a string or "prettyprinted" if format = True."""
     kml_str = self._feature.__str__()
     xml_str = u("<kml {0}>{1}</kml>").format(Kmlable._getnamespaces(), kml_str)
     if format:
        KmlElement.patch()
        kml_str = xml.dom.minidom.parseString(xml_str.encode("utf-8"))
        KmlElement.unpatch()
        return kml_str.toprettyxml(indent="    ", newl="\n", encoding="UTF-8").decode("utf-8")
     else:
         return xml_str
Beispiel #2
0
 def _genkml(self, format=True):
     """Returns the kml as a string or "prettyprinted" if format = True."""
     kml_str = self._feature.__str__()
     xml_str = u("<kml {0}>{1}</kml>").format(Kmlable._getnamespaces(), kml_str)
     if format:
        KmlElement.patch()
        kml_str = xml.dom.minidom.parseString(xml_str.encode("utf-8"))
        KmlElement.unpatch()
        return kml_str.toprettyxml(indent="    ", newl="\n", encoding="UTF-8").decode("utf-8")
     else:
         return xml_str
Beispiel #3
0
 def _genkml(self, format=True):
     """Returns the kml as a string or "prettyprinted" if format = True."""
     kml_str = ""
     if self._feature is not None:
         kml_str = self._feature.__str__()
     networklinkcontrol_str = ""
     if self._networklinkcontrol is not None:
         networklinkcontrol_str = self._networklinkcontrol.__str__()
     if self._hint is not None:
         hint = ' hint="{0}"'.format(self._hint)
     else:
         hint = ''
     xml_str = u("<kml {0}{2}>{1}{3}</kml>").format(Kmlable._getnamespaces(), kml_str, hint, networklinkcontrol_str)
     if format:
        KmlElement.patch()
        kml_str = xml.dom.minidom.parseString(xml_str.encode("utf-8"))
        KmlElement.unpatch()
        return kml_str.toprettyxml(indent="    ", newl="\n", encoding="UTF-8").decode("utf-8")
     else:
         return xml_str