draw lines between location and base
This commit is contained in:
parent
8aa59ef749
commit
efce68ba1f
|
|
@ -24,6 +24,7 @@ To use Mappersons, follow these steps:
|
||||||
This YAML file has a structure that includes the following fields:
|
This YAML file has a structure that includes the following fields:
|
||||||
- `name`: The name of the person or entity.
|
- `name`: The name of the person or entity.
|
||||||
- `image`: The image associated with 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:
|
- `weeks`: A list of weeks, each containing:
|
||||||
- `location`: The location where tasks were performed. Identically to locations.yml
|
- `location`: The location where tasks were performed. Identically to locations.yml
|
||||||
- `tasks`: A list of tasks performed during that week at that location.
|
- `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
|
- name: Lisa Lurch
|
||||||
image: lurch_l.jpg
|
image: lurch_l.jpg
|
||||||
|
base: Hamburg
|
||||||
weeks:
|
weeks:
|
||||||
21/2023:
|
21/2023:
|
||||||
- location: Hamburg
|
- location: Hamburg
|
||||||
|
|
@ -45,6 +47,7 @@ This YAML file has a structure that includes the following fields:
|
||||||
- Maintenance NSP
|
- Maintenance NSP
|
||||||
- name: Walter Wiesel
|
- name: Walter Wiesel
|
||||||
image: wiesel_w.jpg
|
image: wiesel_w.jpg
|
||||||
|
base: Hamburg
|
||||||
weeks:
|
weeks:
|
||||||
21/2023:
|
21/2023:
|
||||||
- location: Teisnach
|
- location: Teisnach
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
function loadWeek(locations) {
|
function loadWeek(locations) {
|
||||||
locations.map(location => {
|
locations.map(location => {
|
||||||
return L.marker([location.lat, location.lng], {
|
L.marker([location.lat, location.lng], {
|
||||||
icon: L.icon({
|
icon: L.icon({
|
||||||
iconUrl: location.icon,
|
iconUrl: location.icon,
|
||||||
iconAnchor: location.anchor
|
iconAnchor: location.anchor
|
||||||
|
|
@ -60,8 +60,12 @@
|
||||||
})
|
})
|
||||||
.bindPopup(location.popup)
|
.bindPopup(location.popup)
|
||||||
.addTo(markerLayer);
|
.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,7 @@ def create_circle(image_paths):
|
||||||
# Cut out a circle from each image
|
# Cut out a circle from each image
|
||||||
circular_images = [circular_mask(img) for img in shrunk_images]
|
circular_images = [circular_mask(img) for img in shrunk_images]
|
||||||
if len(circular_images) == 1:
|
if len(circular_images) == 1:
|
||||||
circular_images[0].save(output_path)
|
return circular_images[0]
|
||||||
return
|
|
||||||
|
|
||||||
if len(circular_images) < 7:
|
if len(circular_images) < 7:
|
||||||
output_img = arrange_images_in_circle(circular_images)
|
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():
|
if week in person['weeks'].keys():
|
||||||
cur_name = person['name']
|
cur_name = person['name']
|
||||||
cur_image = person['image']
|
cur_image = person['image']
|
||||||
|
cur_base = person['base']
|
||||||
for task in person['weeks'][week]:
|
for task in person['weeks'][week]:
|
||||||
cur_loc = task['location']
|
cur_loc = task['location']
|
||||||
cur_tasks = task['tasks']
|
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():
|
if cur_name not in loc[cur_loc].keys():
|
||||||
loc[cur_loc][cur_name] = {
|
loc[cur_loc][cur_name] = {
|
||||||
'image': cur_image,
|
'image': cur_image,
|
||||||
|
'base': cur_base,
|
||||||
'tasks': []
|
'tasks': []
|
||||||
}
|
}
|
||||||
loc[cur_loc][cur_name]['tasks'] += cur_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('/')
|
w,y = week.split('/')
|
||||||
json_file = "cw_%s_%s.json" % (w,y)
|
json_file = "cw_%s_%s.json" % (w,y)
|
||||||
for cur_loc, cur_persons in loc.items():
|
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()]
|
image_paths = [("persons/%s" % x['image']) for n,x in cur_persons.items()]
|
||||||
img = create_circle(image_paths)
|
img = create_circle(image_paths)
|
||||||
img.save(output_path / Path(png_file))
|
img.save(output_path / Path(png_file))
|
||||||
|
bases = []
|
||||||
popup = "<h2>%s</h2>" % cur_loc
|
popup = "<h2>%s</h2>" % cur_loc
|
||||||
for cur_per, cur_info in cur_persons.items():
|
for cur_per, cur_info in cur_persons.items():
|
||||||
popup += "<h3>%s</h3>" % cur_per
|
popup += "<h3>%s</h3>" % cur_per
|
||||||
popup += "</br>".join(cur_info['tasks'])
|
popup += "</br>".join(cur_info['tasks'])
|
||||||
|
if cur_info['base'] != cur_loc:
|
||||||
|
l = [x for x in locations if x['name'] == cur_info['base']][0]
|
||||||
|
bases.append({
|
||||||
|
"city": cur_info['base'],
|
||||||
|
"lat": l['lat'],
|
||||||
|
"lng": l['lng'],
|
||||||
|
})
|
||||||
l = [x for x in locations if x['name'] == cur_loc][0]
|
l = [x for x in locations if x['name'] == cur_loc][0]
|
||||||
week_json.append({
|
week_json.append({
|
||||||
"city": cur_loc,
|
"city": cur_loc,
|
||||||
|
|
@ -115,7 +124,8 @@ def generateWeek(week, persons, locations, output_path=Path('.')):
|
||||||
"lng": l['lng'],
|
"lng": l['lng'],
|
||||||
"icon": png_file,
|
"icon": png_file,
|
||||||
"anchor": [x//2 for x in img.size],
|
"anchor": [x//2 for x in img.size],
|
||||||
"popup": popup
|
"popup": popup,
|
||||||
|
"bases": bases
|
||||||
})
|
})
|
||||||
with open(output_path / Path(json_file),"w") as j:
|
with open(output_path / Path(json_file),"w") as j:
|
||||||
json.dump(week_json, j)
|
json.dump(week_json, j)
|
||||||
|
|
|
||||||
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
|
Before Width: | Height: | Size: 421 KiB After Width: | Height: | Size: 511 KiB |
Loading…
Reference in a new issue