diff --git a/README.md b/README.md index b651ba7..324e1b3 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ To use Mappersons, follow these steps: This YAML file has a structure that includes the following fields: - `name`: The name of the person or entity. - `image`: The image associated with the person or entity. +- `base`: The location where person is based. Identically to locations.yml - `weeks`: A list of weeks, each containing: - `location`: The location where tasks were performed. Identically to locations.yml - `tasks`: A list of tasks performed during that week at that location. @@ -34,6 +35,7 @@ This YAML file has a structure that includes the following fields: --- - name: Lisa Lurch image: lurch_l.jpg + base: Hamburg weeks: 21/2023: - location: Hamburg @@ -45,6 +47,7 @@ This YAML file has a structure that includes the following fields: - Maintenance NSP - name: Walter Wiesel image: wiesel_w.jpg + base: Hamburg weeks: 21/2023: - location: Teisnach diff --git a/index.html b/index.html index 13737f2..a005424 100644 --- a/index.html +++ b/index.html @@ -52,7 +52,7 @@ function loadWeek(locations) { locations.map(location => { - return L.marker([location.lat, location.lng], { + L.marker([location.lat, location.lng], { icon: L.icon({ iconUrl: location.icon, iconAnchor: location.anchor @@ -60,8 +60,12 @@ }) .bindPopup(location.popup) .addTo(markerLayer); + location.bases.map(base => { + return L.polyline([[location.lat, location.lng],[base.lat,base.lng]],{color: 'red', weight: 1}).addTo(markerLayer); + }); + return; }); - map.addLayer(markerLayer) + map.addLayer(markerLayer); } diff --git a/mappersons.py b/mappersons.py index 79a2101..a3eb7b4 100644 --- a/mappersons.py +++ b/mappersons.py @@ -59,8 +59,7 @@ def create_circle(image_paths): # Cut out a circle from each image circular_images = [circular_mask(img) for img in shrunk_images] if len(circular_images) == 1: - circular_images[0].save(output_path) - return + return circular_images[0] if len(circular_images) < 7: output_img = arrange_images_in_circle(circular_images) @@ -85,6 +84,7 @@ def generateWeek(week, persons, locations, output_path=Path('.')): if week in person['weeks'].keys(): cur_name = person['name'] cur_image = person['image'] + cur_base = person['base'] for task in person['weeks'][week]: cur_loc = task['location'] cur_tasks = task['tasks'] @@ -93,6 +93,7 @@ def generateWeek(week, persons, locations, output_path=Path('.')): if cur_name not in loc[cur_loc].keys(): loc[cur_loc][cur_name] = { 'image': cur_image, + 'base': cur_base, 'tasks': [] } loc[cur_loc][cur_name]['tasks'] += cur_tasks @@ -100,14 +101,22 @@ def generateWeek(week, persons, locations, output_path=Path('.')): w,y = week.split('/') json_file = "cw_%s_%s.json" % (w,y) for cur_loc, cur_persons in loc.items(): - png_file = "%s_%s_%s.png" % (cur_loc.lower(),w,y) + png_file = "%s_%s_%s.png" % (cur_loc.lower().replace(' ','_'),w,y) image_paths = [("persons/%s" % x['image']) for n,x in cur_persons.items()] img = create_circle(image_paths) img.save(output_path / Path(png_file)) + bases = [] popup = "