- feature_xml.attrib = json_feature['properties']
- if geo['type'] == 'LineString':
- wrmap_type = dict(zip(WRMAP_LINE_TYPE.values(), WRMAP_LINE_TYPE.keys()))
- feature_xml = xml.etree.ElementTree.SubElement(wrmap_xml, wrmap_type[json_feature['properties']['type']])
- feature_xml.text = create_wrmap_coordinates(geo['coordinates'])
- feature_xml.attrib = json_feature['properties']
-
- return xml.etree.ElementTree.tostring(wrmap_xml)
+ if last_json_feature is not None:
+ last_json_feature.tail = '\n'
+ else:
+ if last_json_feature is not None:
+ last_json_feature.tail = '\n\n'
+ feature_xml.text = '\n' + create_wrmap_coordinates(geo['coordinates']) + '\n'
+ last_json_feature = feature_xml
+ feature_xml.attrib = json_feature['properties']
+ del feature_xml.attrib['type']
+
+ if last_json_feature is not None:
+ last_json_feature.tail = '\n\n'
+ return xml.etree.ElementTree.tostring(wrmap_xml, encoding='utf-8').decode('utf-8')