Skip to content

Commit

Permalink
Version 5 - Drawing Paths directly within the Web App
Browse files Browse the repository at this point in the history
Version 5 - Drawing Paths directly within the Web App

- Adds basic path drawing functionality to the web app (experimental) (5.0.0)
- Fixes a bug where the generated Excel file was buggy (5.0.0)
- Add 1:5'000 scale to the PDF export (5.0.0)
- Dependency updates
  • Loading branch information
wp99cp authored Jul 9, 2024
2 parents 52290cb + 907f45b commit 03a19e4
Show file tree
Hide file tree
Showing 45 changed files with 3,327 additions and 3,331 deletions.
3 changes: 2 additions & 1 deletion .env.ci-testing
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Configuration for the angular application: development or production
ANGULAR_BUILD_MODE=dev
ANGULAR_BUILD_MODE=production
BACKEND_DOMAIN=http://awt-backend:5000
DOCS_DOMAIN=http://awt-docs:4000
FRONTEND_DOMAIN=http://awt-frontend
PRINT_API_BASE_URL=awt-mapfish-print-server
CYPRESS_BASE_URL=http://awt-frontend
VALHALLA_DOMAIN=http://awt-valhalla:8002

# Configures the logging level for the backend
# valid values are DEBUG, INFO, WARNING, ERROR or CRITICAL
Expand Down
1 change: 1 addition & 0 deletions .env.local-dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BACKEND_DOMAIN=http://localhost:5000
DOCS_DOMAIN=http://localhost:4000
FRONTEND_DOMAIN=http://localhost
PRINT_API_BASE_URL=awt-mapfish-print-server
VALHALLA_DOMAIN=http://localhost:8002

# Configures the logging level for the backend
# valid values are DEBUG, INFO, WARNING, ERROR or CRITICAL
Expand Down
1 change: 1 addition & 0 deletions .env.prod-dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BACKEND_DOMAIN=https://backend.dev.map.cevi.tools/
DOCS_DOMAIN=http://docs.dev.map.cevi.tools
FRONTEND_DOMAIN=https://dev.map.cevi.tools
PRINT_API_BASE_URL=awt-mapfish-print-server
VALHALLA_DOMAIN=https://valhalla.dev.map.cevi.tools

# Configures the logging level for the backend
# valid values are DEBUG, INFO, WARNING, ERROR or CRITICAL
Expand Down
1 change: 1 addition & 0 deletions .env.prod-latest
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BACKEND_DOMAIN=https://backend.map.cevi.tools
DOCS_DOMAIN=http://docs.map.cevi.tools
FRONTEND_DOMAIN=https://map.cevi.tools
PRINT_API_BASE_URL=awt-mapfish-print-server
VALHALLA_DOMAIN=https://valhalla.map.cevi.tools

# Configures the logging level for the backend
# valid values are DEBUG, INFO, WARNING, ERROR or CRITICAL
Expand Down
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ updates:
schedule:
interval: "weekly"
target-branch: "dev"

groups:
angular:
applies-to: version-updates
patterns:
- "@angular*"
update-types:
- "minor"
- "patch"
minor-and-patch:
applies-to: security-updates
patterns:
- "@angular*"
update-types:
- "patch"
- "minor"
ignore:
- dependency-name: "@angular*"
update-types: [ "version-update:semver-major" ]

- package-ecosystem: "pip"
directory: "/swiss_TML_api"
schedule:
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ jobs:
- name: 🛎️ Checkout
uses: actions/checkout@v4

# Restores the cache if it exists.
- name: ⛏ Restore docker image from cache
uses: satackey/[email protected]
continue-on-error: true

- name: create dumy files for ./git/HEAD and ./git/refs/heads/
run: |
mkdir -p .git/refs/heads
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Lint

# we run testing for both master and dev branches (but only on pull requests)
# we run testing for both master and dev branches (but only on pull requests for master)
on:
pull_request:
branches:
- 'master'
push:
branches:
- 'dev'

jobs:
Expand Down
10 changes: 7 additions & 3 deletions backend/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import functools
import io
import json
import logging
Expand All @@ -27,9 +26,9 @@
HeightFetcherTransformer,
)
from automatic_walk_time_tables.path_transformers.pois_transfomer import POIsTransformer
from automatic_walk_time_tables.utils.error import UserException
from automatic_walk_time_tables.utils.path import Path
from automatic_walk_time_tables.utils.point import Point_LV95
from automatic_walk_time_tables.utils.error import UserException
from server_logging.log_helper import setup_recursive_logger
from server_logging.status_handler import ExportStateHandler, ExportStateLogger

Expand Down Expand Up @@ -152,7 +151,12 @@ def create_walk_time_table():
douglas_peucker_transformer = DouglasPeuckerTransformer(
number_of_waypoints=21, pois=pois
)
selected_way_points = douglas_peucker_transformer.transform(path)

# we don't use the auto waypoints if the user has disabled them
if options["auto_waypoints"]:
selected_way_points = douglas_peucker_transformer.transform(path)
else:
selected_way_points = pois

end = time.time()
logger.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
from typing import List

import numpy as np
from automatic_walk_time_tables.path_transformers.path_transfomer import PathTransformer
from automatic_walk_time_tables.utils.path import Path

from automatic_walk_time_tables.path_transformers.path_transfomer import PathTransformer
from automatic_walk_time_tables.utils.geometry_utils import (
calc_secant_line,
calc_secant_elevation,
)
from automatic_walk_time_tables.utils.path import Path
from automatic_walk_time_tables.utils.way_point import WayPoint


Expand Down Expand Up @@ -50,7 +50,7 @@ def __init__(self, pois: Path = None, number_of_waypoints=21):

self.pois = pois

def transform(self, path: Path):
def transform(self, path: Path) -> Path:
way_points = self.douglas_peucker(path.copy())
self.__logger.debug(
"%d way point selected for final walk time table",
Expand Down
Binary file modified backend/automatic_walk_time_tables/res/Marschzeit_Template.xlsx
Binary file not shown.
26 changes: 26 additions & 0 deletions backend/automatic_walk_time_tables/utils/file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,35 @@ def parse(
return self.__parse_gpx_file(file_content)
elif extension == "kml":
return self.parse_kml_file__(file_content)
elif extension == "array":
return self.parse_array_file__(file_content)
else:
raise Exception("Unsupported file format")

def parse_array_file__(self, raw_data: str) -> path.Path:

coordinates = raw_data.split(";")
coordinates = [c.split(",") for c in coordinates]

if len(coordinates[0]) == 2:
coordinates = [
point.Point_LV95(float(c[0]), float(c[1])) for c in coordinates
]
else:
coordinates = [
point.Point_LV95(float(c[0]), float(c[1]), float(c[2]))
for c in coordinates
]

path_ = path.Path(coordinates)

if not path_.has_elevation_for_all_points():
path_ = self.height_fetcher.transform(path_)
else:
pass

return path_

def __parse_gpx_file(self, gpx_raw_data: str) -> path.Path:
gpx: gpxpy.gpx = gpxpy.parse(gpx_raw_data)
paths: List[path.Path] = []
Expand Down
6 changes: 3 additions & 3 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Flask==3.0.3
gunicorn==22.0.0
flask-cors==4.0.1
gpxpy==1.6.2
numpy==1.26.4
numpy==2.0.0
geopy==2.4.1
openpyxl==3.1.2
matplotlib==3.9.0
openpyxl==3.1.5
matplotlib==3.9.1
grequests==0.7.0
pyclustering==0.10.1.2
polyline==2.0.2
Expand Down
22 changes: 22 additions & 0 deletions docker-compose.ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,25 @@ services:

logging:
driver: none

healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"]
interval: 2s
timeout: 1s
retries: 60

awt-valhalla:
build:
context: ./route_engine
dockerfile: Dockerfile
environment:
# - tile_urls=https://download.geofabrik.de/europe/switzerland-latest.osm.pbf
- server_threads=2 # determines how many threads will be used to run the valhalla server
- use_tiles_ignore_pbf=True # load existing valhalla_tiles.tar directly
- build_elevation=False # build elevation with "True" or "Force": will download only the elevation for areas covered by the graph tiles
- build_admins=False # build admins db with "True" or "Force"
- build_time_zones=False # build timezone db with "True" or "Force"
- build_tar=True # build an indexed tar file from the tile_dir for faster graph loading times
- force_rebuild=False # forces a rebuild of the routing tiles with "True"
env_file:
- .env.ci-testing
17 changes: 17 additions & 0 deletions docker-compose.prod-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,20 @@ services:
image: registry.cevi.tools/cevi/awt_frontend:dev
env_file:
- .env.prod-dev

awt-valhalla:
build:
context: ./route_engine
dockerfile: Dockerfile
image: registry.cevi.tools/cevi/awt_valhalla:dev
environment:
# - tile_urls=https://download.geofabrik.de/europe/switzerland-latest.osm.pbf
- server_threads=2 # determines how many threads will be used to run the valhalla server
- use_tiles_ignore_pbf=True # load existing valhalla_tiles.tar directly
- build_elevation=False # build elevation with "True" or "Force": will download only the elevation for areas covered by the graph tiles
- build_admins=False # build admins db with "True" or "Force"
- build_time_zones=False # build timezone db with "True" or "Force"
- build_tar=True # build an indexed tar file from the tile_dir for faster graph loading times
- force_rebuild=False # forces a rebuild of the routing tiles with "True"
env_file:
- .env.prod-dev
17 changes: 17 additions & 0 deletions docker-compose.prod-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,20 @@ services:
image: registry.cevi.tools/cevi/awt_frontend:latest
env_file:
- .env.prod-latest

awt-valhalla:
build:
context: ./route_engine
dockerfile: Dockerfile
image: registry.cevi.tools/cevi/awt_valhalla:latest
environment:
# - tile_urls=https://download.geofabrik.de/europe/switzerland-latest.osm.pbf
- server_threads=2 # determines how many threads will be used to run the valhalla server
- use_tiles_ignore_pbf=True # load existing valhalla_tiles.tar directly
- build_elevation=False # build elevation with "True" or "Force": will download only the elevation for areas covered by the graph tiles
- build_admins=False # build admins db with "True" or "Force"
- build_time_zones=False # build timezone db with "True" or "Force"
- build_tar=True # build an indexed tar file from the tile_dir for faster graph loading times
- force_rebuild=False # forces a rebuild of the routing tiles with "True"
env_file:
- .env.prod-latest
23 changes: 21 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

services:

awt-docs:
Expand Down Expand Up @@ -89,6 +87,7 @@ services:
- "80:80"
depends_on:
- awt-backend
- awt-valhalla
env_file:
- .env.local-dev
healthcheck:
Expand All @@ -97,6 +96,26 @@ services:
timeout: 1s
retries: 180

awt-valhalla:
build:
context: ./route_engine
dockerfile: dev.Dockerfile
ports:
- "8002:8002"
volumes:
- ./route_engine/sources/:/custom_files
environment:
# - tile_urls=https://download.geofabrik.de/europe/switzerland-latest.osm.pbf
- server_threads=2 # determines how many threads will be used to run the valhalla server
- use_tiles_ignore_pbf=True # load existing valhalla_tiles.tar directly
- build_elevation=False # build elevation with "True" or "Force": will download only the elevation for areas covered by the graph tiles
- build_admins=False # build admins db with "True" or "Force"
- build_time_zones=False # build timezone db with "True" or "Force"
- build_tar=True # build an indexed tar file from the tile_dir for faster graph loading times
- force_rebuild=False # forces a rebuild of the routing tiles with "True"
env_file:
- .env.local-dev

volumes:
vitepress_dist: {}
node_modules: {}
32 changes: 19 additions & 13 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ export default {
},
{
text: 'API Endpoints', link: '/documentation/backend/API_endpoints'
},,
},
{
text: 'DEPRECATED! Command Line Arguments', link: '/documentation/backend/command_line_arguments'
text: 'DEPRECATED! Command Line Arguments',
link: '/documentation/backend/command_line_arguments'
}
]
},
Expand Down Expand Up @@ -94,12 +95,12 @@ export default {
]
},
{
text: 'Routing Engine',
text: 'Route Engine',
collapsible: true,
collapsed: true,
items: [
{
text: 'About', link: '/documentation/routing_engine/about'
text: 'About', link: '/documentation/route_engine/about'
},
]
},
Expand All @@ -114,17 +115,22 @@ export default {
]
}
],
editLink: {
pattern: 'https://github.com/cevi/automatic_walk-time_tables/edit/master/docs/:path',
text: 'Edit this page on GitHub'
},
socialLinks: [
{
icon: 'github', link: 'https://github.com/cevi/automatic_walk-time_tables'
}
]

},

editLink: {
pattern: 'https://github.com/cevi/automatic_walk-time_tables/edit/master/docs/:path',
text: 'Edit this page on GitHub'
},
socialLinks: [
{
icon: 'github', link: 'https://github.com/cevi/automatic_walk-time_tables'
}
],

search: {
provider: 'local'
}
}

}
2 changes: 1 addition & 1 deletion docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build Stage
FROM node:18.14-alpine3.17 as builder
FROM node:20-alpine3.19 as builder

WORKDIR /app

Expand Down
6 changes: 6 additions & 0 deletions docs/changelog/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

A complete, technical changelog is available at [GitHub](https://github.com/cevi/automatic_walk-time_tables/releases).

## Version 5 - Drawing Paths directly within the Web App
- Adds basic path drawing functionality to the web app (experimental) (5.0.0)
- Fixes a bug where the generated Excel file was buggy (5.0.0)
- Add 1:5'000 scale to the PDF export (5.0.0)
- Dependency updates

## Version 4 - Improved Error handling & drop CLI support
- Add option to delete waypoints (4.1.0)
- Added waypoints are now more likely to be selected for the Excel export (4.1.0)
Expand Down
1 change: 1 addition & 0 deletions docs/documentation/backend/API_endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Creates a walk walk-time-table for a given route, i.e. it calculates the POIs an
```json
{
"encoding": "polyline",
"auto_waypoints": false,
"route": "...",
"elevation_data": "...",
"pois_distance": "0, 0, 1352, 1734, 3031"
Expand Down
Loading

0 comments on commit 03a19e4

Please sign in to comment.