Esempio n. 1
0
def constructKML(urls, course_name):
    """
	Create KML files given the urls and the course names. 
	"""
    doc = GX.kml()
    for url in urls:
        # print url #see if it prints urls
        name = url.split('/')[-1]
        point = points_dict.get(url)
        if point:
            langt, longt = point.strip('POINT()').split(' ')
            pm = GX.Placemark(GX.name(name),
                              GX.Point(GX.coordinates(langt + ',' + longt)))
            doc.append(pm)
    xml = lxml.etree.tostring(doc, pretty_print=True, xml_declaration=True)
    with open(OUTPUT_FOLDER + course_name + '.kml', 'w') as f:
        f.write(xml)
Esempio n. 2
0
def constructKML(urls, course_name):
	"""
	Create KML files given the urls and the course names. 
	"""
	doc = GX.kml()
	for url in urls:
		# print url #see if it prints urls 
		name = url.split('/')[-1]
		point = points_dict.get(url)
		if point:
			langt, longt = point.strip('POINT()').split(' ')
			pm = GX.Placemark(
				GX.name(name),
				GX.Point(
					GX.coordinates(langt + ',' + longt))
				)
			doc.append(pm)
	xml = lxml.etree.tostring(doc, pretty_print=True, xml_declaration=True)
	with open(OUTPUT_FOLDER+course_name+'.kml', 'w') as f:
		f.write(xml)