This commit is contained in:
Tykayn 2025-09-26 17:38:30 +02:00 committed by tykayn
parent 2bb77d2300
commit 98c40b2447
16 changed files with 1836 additions and 361 deletions

View file

@ -207,6 +207,39 @@ class DemoResource:
logger.error(f"Error processing GET request to /demo/map-by-what: {e}")
resp.status = falcon.HTTP_500
resp.text = f"Error: {str(e)}"
def on_get_map_by_what_type(self, req, resp, event_type):
"""
Handle GET requests to the /demo/map-by-what/{type} endpoint.
Returns an HTML page with a MapLibre map showing events of a specific type,
colored by temporality (past/present/future) with a detailed table.
Args:
req: The request object.
resp: The response object.
event_type: The event type to filter by.
"""
logger.info(f"Processing GET request to /demo/map-by-what/{event_type}")
try:
# Set content type to HTML
resp.content_type = 'text/html'
# Render the template with the event type
template = self.jinja_env.get_template('map_by_what_type.html')
html = template.render(
event_type=event_type,
event_type_label=event_type.replace('_', ' ').title()
)
# Set the response body and status
resp.text = html
resp.status = falcon.HTTP_200
logger.success(f"Successfully processed GET request to /demo/map-by-what/{event_type}")
except Exception as e:
logger.error(f"Error processing GET request to /demo/map-by-what/{event_type}: {e}")
resp.status = falcon.HTTP_500
resp.text = f"Error: {str(e)}"
events_by_what = defaultdict(list)
if events_data.get('features'):