Skip to content

Commit 70ba73b

Browse files
maede97dependabot[bot]wp99cp
authored
Minor Update: Circular Paths & updates (#204)
* Update index.html (#197) Translate the english title to german (short variant instead of "Automatisierte Marschzeittabellen") * Bump socket.io-parser from 4.2.2 to 4.2.4 in /frontend (#195) Bumps [socket.io-parser](https://github.com/socketio/socket.io-parser) from 4.2.2 to 4.2.4. - [Release notes](https://github.com/socketio/socket.io-parser/releases) - [Changelog](https://github.com/socketio/socket.io-parser/blob/main/CHANGELOG.md) - [Commits](socketio/socket.io-parser@4.2.2...4.2.4) --- updated-dependencies: - dependency-name: socket.io-parser dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Cyrill Püntener <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 3.2.4 to 3.2.7 in /docs (#194) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 3.2.4 to 3.2.7. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v3.2.7/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v3.2.7/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Cyrill Püntener <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update Readme.md (#198) Add german dev notes to readme Co-authored-by: Cyrill Püntener <[email protected]> * Fix Issue 138 & Cypress ENV (#199) * Fix issue 138 * fix cypress env var * Bump pillow from 9.3.0 to 10.0.1 in /swiss_TLM_api (#203) * add parser for circular kml files (#200) * bump version * Bump postcss from 8.4.19 to 8.4.31 in /docs (#208) Bumps [postcss](https://github.com/postcss/postcss) from 8.4.19 to 8.4.31. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md) - [Commits](postcss/postcss@8.4.19...8.4.31) --- updated-dependencies: - dependency-name: postcss dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Cyrill Püntener <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pillow from 9.3.0 to 10.0.1 in /swiss_TLM_api (#205) Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.3.0 to 10.0.1. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](python-pillow/Pillow@9.3.0...10.0.1) --- updated-dependencies: - dependency-name: pillow dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Cyrill Püntener <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix bugs in name_index creator * fix naming in bodenbedeckungen * update changelog --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cyrill Püntener <[email protected]>
1 parent b33a113 commit 70ba73b

File tree

22 files changed

+120
-73
lines changed

22 files changed

+120
-73
lines changed

.env.ci-testing

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ ANGULAR_BUILD_MODE=dev
33
BACKEND_DOMAIN=http://awt-backend:5000
44
DOCS_DOMAIN=http://awt-docs:4000
55
FRONTEND_DOMAIN=http://awt-frontend
6+
PRINT_API_BASE_URL=awt-mapfish-print-server
7+
CYPRESS_BASE_URL=http://awt-frontend
68

79
# Configures the logging level for the backend
810
# valid values are DEBUG, INFO, WARNING, ERROR or CRITICAL

.env.local-dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ANGULAR_BUILD_MODE=dev
33
BACKEND_DOMAIN=http://localhost:5000
44
DOCS_DOMAIN=http://localhost:4000
55
FRONTEND_DOMAIN=http://localhost
6+
PRINT_API_BASE_URL=awt-mapfish-print-server
67

78
# Configures the logging level for the backend
89
# valid values are DEBUG, INFO, WARNING, ERROR or CRITICAL

.env.prod-dev

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ANGULAR_BUILD_MODE=dev
33
BACKEND_DOMAIN=https://backend.dev.map.cevi.tools/
44
DOCS_DOMAIN=http://docs.dev.map.cevi.tools
55
FRONTEND_DOMAIN=https://dev.map.cevi.tools
6+
PRINT_API_BASE_URL=awt-mapfish-print-server
67

78
# Configures the logging level for the backend
89
# valid values are DEBUG, INFO, WARNING, ERROR or CRITICAL

.env.prod-latest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ANGULAR_BUILD_MODE=production
33
BACKEND_DOMAIN=https://backend.map.cevi.tools
44
DOCS_DOMAIN=http://docs.map.cevi.tools
55
FRONTEND_DOMAIN=https://map.cevi.tools
6+
PRINT_API_BASE_URL=awt-mapfish-print-server
67

78
# Configures the logging level for the backend
89
# valid values are DEBUG, INFO, WARNING, ERROR or CRITICAL

Readme.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ Aktivität in keinerlei Hinsicht ersetzt!
5353
| Marschzeittabelle | Tabelle zum Abschätzen der Marschzeit einer Wanderung. Enthält oft auch Angaben zu Pausen und ein Höhenprofil. J+S empfehlt für jede Wanderung eine Marschzeittabelle zu erstellen. |
5454
| SchweizMobil | Ermöglicht das Planen von Wanderungen und Velo-Touren der digitalen Landeskarte. Die magnetischen Wege beschleunigen den Prozess des Einzeichnens einer Route. |
5555

56+
## Lokal ausführen und entwickeln
57+
Das Projekt ist Docker-basiert. Aus diesem Grund ist es ganz einfach, die Container zu builden:
58+
```
59+
docker-compose up [--build]
60+
```
61+
*Notiz:* `--build` ist optional und führt dazu, dass die Container neu gebuildet werden.
62+
63+
Durchsuche auch die Dokumentation unter [Getting Started](https://docs.map.cevi.tools/) (momentan nur auf Englisch verfügbar). Die Dokumentation kann auch bei einer lokal laufenden Instanz unter folgender URL abgerufen werden: `localhost:4000` (bei laufenden Containern).
64+
5665
# Generating J+S-Walk-Time-Tables
5766

5867
The aim of this project is to automate and speed up the process of creating a J+S walk-time table for a hike or bike
@@ -81,4 +90,4 @@ docker-compose up [--build]
8190
*Note:* `--build` is optional and forces docker to rebuild the containers.
8291

8392
Simply take a look at the documentation [Getting Started](https://docs.map.cevi.tools/). The docs can also be accessed
84-
from your local build by visiting `localhost:4000` (once the containers are running).
93+
from your local build by visiting `localhost:4000` (once the containers are running).

backend/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ COPY . /app
1515

1616
EXPOSE 5000
1717

18-
ENV PRINT_API_BASE_URL=awt-mapfish-print-server
19-
2018
# Entrypoint
2119
CMD gunicorn --bind :5000 --workers 1 --threads 2 --timeout 60 app:app

backend/automatic_walk_time_tables/path_transformers/pois_transfomer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ def pois_from_distance_string(self, path: Path):
3939

4040
index = 0
4141
for i, point in enumerate(path.way_points):
42-
43-
if point.accumulated_distance - int(poi_distances[index]) >= 0:
42+
if point.accumulated_distance - int(float(poi_distances[index])) >= 0: # fix bug where poi_distances contained a non-int value
4443
pois.append(point)
4544
index += 1
4645

backend/automatic_walk_time_tables/utils/file_parser.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,25 @@ def parse_kml_file__(self, raw_data: str) -> path.Path:
110110
start_index = raw_data.find('<LineString>')
111111
end_index = raw_data.find('</LineString>')
112112

113+
is_circular = False
114+
113115
# check if <LineString> and </LineString> are found
114116
if start_index == -1 or end_index == -1:
115-
raise Exception('No <LineString> or </LineString> found')
116-
117-
# remove <LineString> and </LineString>
118-
raw_data = raw_data[start_index + len('<LineString>'):end_index]
117+
self.__logger.info('No <LineString> or </LineString> found --> circular path')
118+
is_circular = True
119+
120+
# check for circular path
121+
start_index = raw_data.find('<LinearRing>')
122+
end_index = raw_data.find('</LinearRing>')
123+
124+
if start_index == -1 or end_index == -1:
125+
raise Exception('No <LinearRing> or </LinearRing> found')
126+
127+
# remove <LinearRing> and </LinearRing>
128+
raw_data = raw_data[start_index + len('<LinearRing>'):end_index]
129+
else:
130+
# remove <LineString> and </LineString>
131+
raw_data = raw_data[start_index + len('<LineString>'):end_index]
119132

120133
# carve out contents of <coordinates>...</coordinates>
121134
start_index = raw_data.find('<coordinates>')
@@ -132,6 +145,10 @@ def parse_kml_file__(self, raw_data: str) -> path.Path:
132145
coordinates = [c.split(',') for c in coordinates]
133146
has_elevation = len(coordinates[0]) == 3
134147

148+
if is_circular:
149+
# if circular, add the first point again in the end (close circuit)
150+
coordinates.append(coordinates[0])
151+
135152
self.__logger.debug("Loaded KML file with " + str(len(coordinates)) + " coordinates.")
136153

137154
if not has_elevation:

backend/local-dev.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ RUN pip install --no-cache-dir -r automatic_walk_time_tables/requirements.txt
1111
COPY ./requirements.txt /app
1212
RUN pip install --no-cache-dir -r requirements.txt
1313

14-
EXPOSE 5000
14+
# no need to copy "." to /app (it is mounted by the docker-compose.yml file in the project root)
1515

16-
ENV PRINT_API_BASE_URL=awt-mapfish-print-server
16+
EXPOSE 5000
1717

1818
# Entrypoint
1919
CMD gunicorn --bind :5000 --workers 1 --threads 2 --timeout 60 --reload app:app

docker-compose.ci-testing.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ services:
1010
awt-frontend:
1111
condition: service_healthy
1212

13-
environment:
14-
- CYPRESS_baseUrl=http://awt-frontend
15-
1613
entrypoint: cypress run --browser chrome
1714

1815
# share the current folder as volume to avoid copying

0 commit comments

Comments
 (0)