- Add parse_coordinate() function to handle both decimal degrees and DMS format - Replace direct float() conversion with robust coordinate parsing - Add proper validation for latitude/longitude ranges - Create user-friendly error page instead of showing stack traces - Support formats like "56°5'58.56"N" and "3°22'33.71"W" - Update both /detail and / routes with improved error handling Fixes #29: Don't return stack trace when lat/lon are not integers
41 lines
996 B
HTML
41 lines
996 B
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Geocode to Commons: coordinate error{% endblock %}
|
|
|
|
|
|
{% block content %}
|
|
<div class="m-3">
|
|
<h1>Geocode coordinates to Commons Category</h1>
|
|
|
|
<div class="alert alert-danger" role="alert">
|
|
{{ error }}
|
|
</div>
|
|
|
|
|
|
<div class="coordinates">
|
|
<strong>Received coordinates:</strong><br>
|
|
Latitude: {{ lat_str }}<br>
|
|
Longitude: {{ lon_str }}
|
|
</div>
|
|
|
|
<div class="help-section">
|
|
<h2 class="help-title">Supported coordinate formats:</h2>
|
|
|
|
<div class="examples">
|
|
<div class="example">Decimal degrees: 56.099600, -3.376031</div>
|
|
<div class="example">DMS format: 56°5'58.56"N, 3°22'33.71"W</div>
|
|
<div class="example">Mixed format: 56.099600, 3°22'33.71"W</div>
|
|
</div>
|
|
|
|
|
|
<p>
|
|
<div>Latitude must be between -90 and 90 degrees.</div>
|
|
<div>Longitude must be between -180 and 180 degrees.</div>
|
|
</p>
|
|
</div>
|
|
|
|
<a href="{{ url_for('index') }}" class="back-link">← Back to Home</a>
|
|
|
|
</div>
|
|
{% endblock %}
|