def show_distance(fname):
	"""calculates distance from points saved in doc.kml which is part of .kmz
	   zip archive file"""
	path_cnt = 0
	zf = zipfile.ZipFile(fname, 'r')
	for fn in zf.namelist():
		if fn.endswith('.kml'):
			content = zf.read(fn)
			xmldoc = minidom.parseString(content)
			placemarks = xmldoc.getElementsByTagName('Placemark')
			for placemark in placemarks:
				name = placemark.getElementsByTagName('name')
				if name:
					name = name[0].firstChild.data.strip()
					coordinates = placemark.getElementsByTagName('coordinates')
					if coordinates:
						coordinates = coordinates[0].firstChild.data.strip()
						if coordinates:
							distance_km = get_distance(coordinates)
							if distance_km > 0.0:
								if path_cnt == 0:
									print '\n%s:' % (fname)
								path_cnt += 1
								print('\t%s\t%5.2f' % (name, distance_km))
	return path_cnt
calculates distance from points saved in doc.kml which is part of .kmz
	   zip archive file
recipes/Python/576782_Calculate_distance_kmz/recipe-576782.py