Commit graph

49 commits

Author SHA1 Message Date
90b009fc90 Return nearest parish/polygon for points in the sea near the coast
When a point falls in the sea within a country boundary (e.g. Scotland
Q22 or England Q21) but not within any specific parish, find the nearest
civil parish or high-admin-level polygon within ~0.15 degrees (~10-17km).

- Add get_nearest_scotland_code() for Scottish civil parishes
- Add Polygon.nearest() for general OSM polygon lookup
- Use .limit(1).scalar() in scotland.py for cleaner returns
2026-02-12 18:19:38 +00:00
7235df4cad Fix coordinate parsing to handle DMS format and prevent stack traces
- 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
2025-07-15 09:05:31 +00:00
78b8a7d07f Fix SQLAlchemy deprecation warnings
- Import text from sqlalchemy
- Wrap "SELECT 1" statements in text() function in index() and
  detail_page()
- Addresses SQLAlchemy 2.0+ requirement for explicit text() wrapper on
  raw SQL strings
2025-07-15 08:46:04 +00:00
e1f6b09ec1 Web interface with map where user can place pin for testing
Closes: #21
2024-01-10 16:25:22 +00:00
1625f3d5d1 Show SPARQL query on details page with link to WDQS
Closes: #23
2024-01-10 16:24:54 +00:00
fe3fc85efe Add another fallback 2024-01-09 11:37:02 +00:00
88d46c1dcd Use fallback if Scottish civil parish lookup fails 2023-12-27 15:06:14 +00:00
223cdc4728 Report 100 most recent results where missing=true
Closes: #16
2023-12-15 11:16:35 +00:00
65e3de1b57 Show top locations queried on reports page
Closes: #14
2023-12-15 10:03:54 +00:00
d001ec1155 Pass lat/lon as floats
Closes: #18
2023-12-12 09:43:57 +00:00
29426e2462 Add workaround for Q68816332 mapping to Orphir 2023-12-11 15:46:49 +00:00
96e3bac55c Show average response time on reports page
Closes: #13
2023-12-10 17:31:31 +00:00
e65f85becb Start logging response time ms 2023-12-10 10:41:36 +00:00
8bfe86ee82 Add reports page
Closes: #7
2023-12-10 10:32:15 +00:00
b671843aea Show error page
Closes: #10
2023-11-25 14:29:34 +00:00
06f2d7f804 Report lat/lon out of bound errors
Closes: #9
2023-11-25 13:59:24 +00:00
cfa0bab9fc Don't lookup FQDN if no remote IP 2023-11-25 12:51:45 +00:00
b6825564c7 Send error mail to admin
Closes: #8
2023-11-25 11:41:53 +00:00
231cab309d Log FQDN 2023-11-24 15:35:54 +00:00
4720814e1f Log usage
Closes: #6
2023-11-24 15:13:00 +00:00
62dad7640a Add top-level docstring to lookup.py 2023-11-17 12:23:03 -03:00
d425133423 Catch database connection error and show error page
Closes: #5
2023-11-17 12:21:07 -03:00
690d3281df Make random page show polygon on map 2023-11-04 21:36:05 +00:00
ea2f172388 Fixed type hints 2023-11-04 21:35:33 +00:00
b700f88da6 boundary=place is valid
Example: 51.4564, -0.6486 -> Windsor (Q464955)
2023-11-04 21:22:09 +00:00
50c222d66a Split up code into functions to ease comprehension 2023-11-04 20:49:36 +00:00
a6286cb05f Show map on details page
Includes pin and polygon

Closes: #4
2023-11-03 10:32:18 +00:00
d24744bc29 Various improvements 2023-10-13 19:11:02 +01:00
2519ea74b8 Match on boundary=political 2023-10-13 16:48:56 +01:00
e975e86af5 Add types and docstrings. 2023-10-12 20:34:42 +01:00
5c01d9aebf Format code with black 2023-10-10 10:08:59 +01:00
ab81201908 Remove unused pprint import 2023-10-10 09:08:31 +01:00
faa0b3cb4e Bug fixes and improvements. 2023-10-10 07:27:25 +00:00
a5f7ba917d Bug fixes 2022-05-18 14:12:34 +01:00
c5a66abb25 Move code around 2021-04-17 19:29:09 +02:00
44241751b2 Query database instead of overpass 2021-04-17 18:31:58 +02:00
54b280655f Moving code around 2021-04-17 18:02:53 +02:00
fbcf3d102b bug fixes 2021-04-16 22:35:11 +02:00
59611dd077 reorder functions and rename template 2021-04-16 22:30:25 +02:00
dc24e3f7e7 split out more code 2021-04-16 22:24:59 +02:00
cec535ee7e Split up some code 2021-04-16 20:24:23 +01:00
529c31fce6 Apply black code formatter 2021-04-16 16:22:39 +01:00
5c501b80f0 Tidy the code 2021-04-16 16:21:38 +01:00
b8e217d9e4 two newlines between functions 2021-04-16 16:14:32 +01:00
365d81a1f0 New function to generate random coords 2021-04-16 16:14:12 +01:00
0df666742e Bug fixes 2021-04-15 12:28:02 +01:00
a74b335782 More examples 2021-04-15 12:26:17 +01:00
1cbecf5fe8 Set user-agent 2021-04-15 12:25:14 +01:00
2235675418 initial commit 2019-08-18 15:56:53 +01:00