diff --git a/maps.py b/maps.py
index 4cc104c7d..c3fc78c28 100644
--- a/maps.py
+++ b/maps.py
@@ -466,6 +466,35 @@ def add_tag_map_links(tag_maps_dir: str, tag_name: str,
print('EX: error writing tag map ' + tag_map_filename)
+def _gpx_location(latitude: float, longitude: float, post_id: str) -> str:
+ """Returns a gpx waypoint
+ """
+ map_str = '\n'
+ map_str += ' ' + post_id + '\n'
+ map_str += ' \n'
+ map_str += '\n'
+ return map_str
+
+
+def _kml_location(place_ctr: int,
+ latitude: float, longitude: float, post_id: str) -> str:
+ """Returns a kml placemark
+ """
+ map_str = '\n'
+ map_str += ' ' + str(place_ctr) + '\n'
+ map_str += ' ' + \
+ post_id + '\n]]>\n'
+ map_str += ' \n'
+ map_str += ' \n'
+ map_str += ' ' + str(longitude) + ',' + \
+ str(latitude) + ',0\n'
+ map_str += ' \n'
+ map_str += '\n'
+ return map_str
+
+
def _hashtag_map_to_format(base_dir: str, tag_name: str,
start_hours_since_epoch: int,
end_hours_since_epoch: int,
@@ -525,23 +554,10 @@ def _hashtag_map_to_format(base_dir: str, tag_name: str,
continue
place_ctr += 1
if map_format == 'gpx':
- map_str += '\n'
- map_str += ' ' + post_id + '\n'
- map_str += ' \n'
- map_str += '\n'
+ map_str += _gpx_location(latitude, longitude, post_id)
else:
- map_str += '\n'
- map_str += ' ' + str(place_ctr) + '\n'
- map_str += ' ' + \
- post_id + '\n]]>\n'
- map_str += ' \n'
- map_str += ' \n'
- map_str += ' ' + str(longitude) + ',' + \
- str(latitude) + ',0\n'
- map_str += ' \n'
- map_str += '\n'
+ map_str += \
+ _kml_location(place_ctr, latitude, longitude, post_id)
if map_format == 'gpx':
map_str += ''