添加2号目标坐标coordinate

lzh
Kenneth 3 days ago
parent 3a71eb6df3
commit 31c3792298

@ -0,0 +1,38 @@
import qrcode
import os
def read_file_content(file_path):
"""读取文件内容并返回字符串"""
with open(file_path, 'r', encoding='utf-8') as file:
return file.read()
def generate_qr_code(data, output_path):
"""生成包含指定数据的二维码图像并保存到指定路径"""
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
qr.add_data(data)
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white")
img.save(output_path)
# 指定文件路径
file_path = r"E:\_Ufo\000jiegou\TheBattleCar\coordinate.txt"
output_qr_path = r"E:\_Ufo\000jiegou\TheBattleCar\coordinate_qr.png"
# 检查文件是否存在
if not os.path.exists(file_path):
print(f"文件 {file_path} 不存在。")
exit(1)
# 读取文件内容
file_content = read_file_content(file_path)
# 生成二维码图像
generate_qr_code(file_content, output_qr_path)
print(f"二维码已成功生成并保存到 {output_qr_path}")

@ -7327,3 +7327,205 @@
2024-11-25 20:20:44,238 - INFO - Handling file upload request
2024-11-25 20:20:44,270 - WARNING - File type not allowed
2024-11-25 20:20:44,276 - INFO - 127.0.0.1 - - [25/Nov/2024 20:20:44] "POST /upload HTTP/1.1" 400 -
2024-11-27 08:19:21,355 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://192.168.91.210:8000
2024-11-27 08:19:21,355 - INFO - Press CTRL+C to quit
2024-11-27 08:19:21,434 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 08:19:22,275 - WARNING - * Debugger is active!
2024-11-27 08:19:22,291 - INFO - * Debugger PIN: 266-144-430
2024-11-27 08:19:28,372 - INFO - * Detected change in 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\\Lib\\_strptime.py', reloading
2024-11-27 08:19:28,366 - INFO - Handling login request
2024-11-27 08:19:28,554 - INFO - * Detected change in 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\\Lib\\encodings\\unicode_escape.py', reloading
2024-11-27 08:19:28,554 - INFO - 127.0.0.1 - - [27/Nov/2024 08:19:28] "GET /login HTTP/1.1" 200 -
2024-11-27 08:19:28,698 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 08:19:29,541 - WARNING - * Debugger is active!
2024-11-27 08:19:29,546 - INFO - * Debugger PIN: 266-144-430
2024-11-27 08:19:29,682 - INFO - 127.0.0.1 - - [27/Nov/2024 08:19:29] "GET /static/login.css HTTP/1.1" 200 -
2024-11-27 08:19:29,809 - INFO - 127.0.0.1 - - [27/Nov/2024 08:19:29] "GET /favicon.ico HTTP/1.1" 404 -
2024-11-27 08:19:36,893 - INFO - Handling login request
2024-11-27 08:19:36,968 - INFO - User scout logged in with role 侦查者
2024-11-27 08:19:36,973 - INFO - 127.0.0.1 - - [27/Nov/2024 08:19:36] "POST /login HTTP/1.1" 302 -
2024-11-27 08:19:36,986 - INFO - Accessing scout page
2024-11-27 08:19:36,999 - INFO - Notifications fetched: ()
2024-11-27 08:19:37,028 - INFO - 127.0.0.1 - - [27/Nov/2024 08:19:37] "GET /scout HTTP/1.1" 200 -
2024-11-27 08:19:37,081 - INFO - 127.0.0.1 - - [27/Nov/2024 08:19:37] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 08:23:45,486 - INFO - Handling login request
2024-11-27 08:23:45,493 - INFO - 127.0.0.1 - - [27/Nov/2024 08:23:45] "GET /login HTTP/1.1" 200 -
2024-11-27 08:23:50,118 - INFO - Handling login request
2024-11-27 08:23:50,126 - INFO - User scout logged in with role 侦查者
2024-11-27 08:23:50,130 - INFO - 127.0.0.1 - - [27/Nov/2024 08:23:50] "POST /login HTTP/1.1" 302 -
2024-11-27 08:23:50,142 - INFO - Accessing scout page
2024-11-27 08:23:50,142 - INFO - Notifications fetched: ()
2024-11-27 08:23:50,147 - INFO - 127.0.0.1 - - [27/Nov/2024 08:23:50] "GET /scout HTTP/1.1" 200 -
2024-11-27 08:23:50,212 - INFO - 127.0.0.1 - - [27/Nov/2024 08:23:50] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 08:25:17,598 - INFO - 192.168.91.189 - - [27/Nov/2024 08:25:17] "GET / HTTP/1.1" 200 -
2024-11-27 08:25:17,646 - INFO - 192.168.91.189 - - [27/Nov/2024 08:25:17] "GET /static/login.css HTTP/1.1" 200 -
2024-11-27 08:25:18,068 - INFO - 192.168.91.189 - - [27/Nov/2024 08:25:18] "GET /favicon.ico HTTP/1.1" 404 -
2024-11-27 08:25:39,930 - INFO - Handling login request
2024-11-27 08:25:39,930 - WARNING - Invalid username
2024-11-27 08:25:39,930 - INFO - 192.168.91.189 - - [27/Nov/2024 08:25:39] "POST /login HTTP/1.1" 200 -
2024-11-27 09:36:24,757 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://192.168.91.210:8000
2024-11-27 09:36:24,757 - INFO - Press CTRL+C to quit
2024-11-27 09:36:24,796 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 09:36:27,025 - WARNING - * Debugger is active!
2024-11-27 09:36:27,037 - INFO - * Debugger PIN: 266-144-430
2024-11-27 09:36:28,321 - INFO - 127.0.0.1 - - [27/Nov/2024 09:36:28] "GET /scout HTTP/1.1" 302 -
2024-11-27 09:36:28,343 - INFO - * Detected change in 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\\Lib\\_strptime.py', reloading
2024-11-27 09:36:28,336 - INFO - Handling login request
2024-11-27 09:36:28,471 - INFO - * Detected change in 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\\Lib\\encodings\\unicode_escape.py', reloading
2024-11-27 09:36:28,475 - INFO - 127.0.0.1 - - [27/Nov/2024 09:36:28] "GET /login?next=/scout HTTP/1.1" 200 -
2024-11-27 09:36:28,821 - INFO - 127.0.0.1 - - [27/Nov/2024 09:36:28] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 09:36:29,428 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 09:36:31,668 - WARNING - * Debugger is active!
2024-11-27 09:36:31,681 - INFO - * Debugger PIN: 266-144-430
2024-11-27 09:36:34,666 - INFO - Handling login request
2024-11-27 09:36:34,802 - INFO - User scout logged in with role 侦查者
2024-11-27 09:36:34,802 - INFO - 127.0.0.1 - - [27/Nov/2024 09:36:34] "POST /login HTTP/1.1" 302 -
2024-11-27 09:36:34,837 - INFO - Accessing scout page
2024-11-27 09:36:34,841 - INFO - Notifications fetched: ()
2024-11-27 09:36:34,856 - INFO - 127.0.0.1 - - [27/Nov/2024 09:36:34] "GET /scout HTTP/1.1" 200 -
2024-11-27 09:36:35,176 - INFO - 127.0.0.1 - - [27/Nov/2024 09:36:35] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 09:38:00,807 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://192.168.91.210:8000
2024-11-27 09:38:00,807 - INFO - Press CTRL+C to quit
2024-11-27 09:38:00,833 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 09:38:03,100 - WARNING - * Debugger is active!
2024-11-27 09:38:03,112 - INFO - * Debugger PIN: 266-144-430
2024-11-27 09:38:04,361 - INFO - Handling login request
2024-11-27 09:38:04,490 - INFO - 127.0.0.1 - - [27/Nov/2024 09:38:04] "GET /login?next=/scout HTTP/1.1" 200 -
2024-11-27 09:38:05,065 - INFO - 127.0.0.1 - - [27/Nov/2024 09:38:05] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 09:38:10,023 - INFO - Handling login request
2024-11-27 09:38:10,050 - INFO - User scout logged in with role 侦查者
2024-11-27 09:38:10,058 - INFO - 127.0.0.1 - - [27/Nov/2024 09:38:10] "POST /login HTTP/1.1" 302 -
2024-11-27 09:38:10,086 - INFO - Accessing scout page
2024-11-27 09:38:10,088 - INFO - Notifications fetched: ()
2024-11-27 09:38:10,099 - INFO - 127.0.0.1 - - [27/Nov/2024 09:38:10] "GET /scout HTTP/1.1" 200 -
2024-11-27 09:38:10,196 - INFO - 127.0.0.1 - - [27/Nov/2024 09:38:10] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 09:48:33,344 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://192.168.91.210:8000
2024-11-27 09:48:33,344 - INFO - Press CTRL+C to quit
2024-11-27 09:48:33,380 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 09:48:35,494 - WARNING - * Debugger is active!
2024-11-27 09:48:35,513 - INFO - * Debugger PIN: 266-144-430
2024-11-27 09:48:37,071 - INFO - Handling login request
2024-11-27 09:48:37,195 - INFO - 127.0.0.1 - - [27/Nov/2024 09:48:37] "GET /login?next=/scout HTTP/1.1" 200 -
2024-11-27 09:48:39,112 - INFO - Handling login request
2024-11-27 09:48:39,133 - INFO - 127.0.0.1 - - [27/Nov/2024 09:48:39] "GET /login?next=/scout HTTP/1.1" 200 -
2024-11-27 09:48:39,445 - INFO - 127.0.0.1 - - [27/Nov/2024 09:48:39] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 09:48:44,838 - INFO - Handling login request
2024-11-27 09:48:44,868 - INFO - User scout logged in with role 侦查者
2024-11-27 09:48:44,868 - INFO - 127.0.0.1 - - [27/Nov/2024 09:48:44] "POST /login HTTP/1.1" 302 -
2024-11-27 09:48:44,903 - INFO - Accessing scout page
2024-11-27 09:48:44,907 - INFO - Notifications fetched: ()
2024-11-27 09:48:44,913 - INFO - 127.0.0.1 - - [27/Nov/2024 09:48:44] "GET /scout HTTP/1.1" 200 -
2024-11-27 09:48:45,008 - INFO - 127.0.0.1 - - [27/Nov/2024 09:48:45] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 10:13:47,084 - INFO - * Detected change in 'e:\\_Ufo\\000jiegou\\TheBattleCar\\test.py', reloading
2024-11-27 10:13:48,167 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 10:13:50,433 - WARNING - * Debugger is active!
2024-11-27 10:13:50,446 - INFO - * Debugger PIN: 266-144-430
2024-11-27 11:11:36,549 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://192.168.91.210:8000
2024-11-27 11:11:36,549 - INFO - Press CTRL+C to quit
2024-11-27 11:11:36,565 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 11:11:37,443 - WARNING - * Debugger is active!
2024-11-27 11:11:37,447 - INFO - * Debugger PIN: 266-144-430
2024-11-27 11:11:40,947 - INFO - * Detected change in 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\\Lib\\_strptime.py', reloading
2024-11-27 11:11:40,946 - INFO - Handling login request
2024-11-27 11:11:41,006 - INFO - * Detected change in 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\\Lib\\encodings\\unicode_escape.py', reloading
2024-11-27 11:11:41,006 - INFO - 127.0.0.1 - - [27/Nov/2024 11:11:41] "GET /login HTTP/1.1" 200 -
2024-11-27 11:11:41,171 - INFO - 127.0.0.1 - - [27/Nov/2024 11:11:41] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 11:11:41,712 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 11:11:42,619 - WARNING - * Debugger is active!
2024-11-27 11:11:42,626 - INFO - * Debugger PIN: 266-144-430
2024-11-27 11:12:16,209 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://192.168.91.210:8000
2024-11-27 11:12:16,209 - INFO - Press CTRL+C to quit
2024-11-27 11:12:16,224 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 11:12:17,074 - WARNING - * Debugger is active!
2024-11-27 11:12:17,076 - INFO - * Debugger PIN: 266-144-430
2024-11-27 11:13:37,983 - INFO - Handling login request
2024-11-27 11:13:38,033 - INFO - 169.254.201.64 - - [27/Nov/2024 11:13:38] "GET /login HTTP/1.1" 200 -
2024-11-27 11:13:44,159 - INFO - 169.254.201.64 - - [27/Nov/2024 11:13:44] "GET /static/login.css HTTP/1.1" 200 -
2024-11-27 11:13:50,339 - INFO - 169.254.201.64 - - [27/Nov/2024 11:13:50] "GET /favicon.ico HTTP/1.1" 404 -
2024-11-27 11:14:02,713 - INFO - 169.254.14.191 - - [27/Nov/2024 11:14:02] "GET / HTTP/1.1" 200 -
2024-11-27 11:14:05,751 - INFO - 169.254.14.191 - - [27/Nov/2024 11:14:05] "GET /static/login.css HTTP/1.1" 200 -
2024-11-27 11:14:08,854 - INFO - 169.254.14.191 - - [27/Nov/2024 11:14:08] "GET /favicon.ico HTTP/1.1" 404 -
2024-11-27 11:14:53,648 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://192.168.91.210:8000
2024-11-27 11:14:53,649 - INFO - Press CTRL+C to quit
2024-11-27 11:14:53,663 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 11:14:54,480 - WARNING - * Debugger is active!
2024-11-27 11:14:54,485 - INFO - * Debugger PIN: 266-144-430
2024-11-27 11:15:03,629 - INFO - Handling login request
2024-11-27 11:15:03,684 - INFO - 169.254.201.64 - - [27/Nov/2024 11:15:03] "GET /login HTTP/1.1" 200 -
2024-11-27 11:15:09,801 - INFO - 169.254.201.64 - - [27/Nov/2024 11:15:09] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 11:15:21,244 - INFO - Handling login request
2024-11-27 11:15:21,255 - INFO - User scout logged in with role 侦查者
2024-11-27 11:15:21,259 - INFO - 169.254.201.64 - - [27/Nov/2024 11:15:21] "POST /login HTTP/1.1" 302 -
2024-11-27 11:15:27,322 - INFO - Accessing scout page
2024-11-27 11:15:27,325 - INFO - Notifications fetched: ()
2024-11-27 11:15:27,330 - INFO - 169.254.201.64 - - [27/Nov/2024 11:15:27] "GET /scout HTTP/1.1" 200 -
2024-11-27 11:15:33,465 - INFO - 169.254.201.64 - - [27/Nov/2024 11:15:33] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 11:33:37,794 - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8000
* Running on http://192.168.91.210:8000
2024-11-27 11:33:37,796 - INFO - Press CTRL+C to quit
2024-11-27 11:33:37,834 - INFO - * Restarting with watchdog (windowsapi)
2024-11-27 11:33:40,205 - WARNING - * Debugger is active!
2024-11-27 11:33:40,215 - INFO - * Debugger PIN: 266-144-430
2024-11-27 11:33:46,867 - INFO - Handling login request
2024-11-27 11:33:47,033 - INFO - 169.254.201.64 - - [27/Nov/2024 11:33:47] "GET /login HTTP/1.1" 200 -
2024-11-27 11:33:47,408 - INFO - 169.254.201.64 - - [27/Nov/2024 11:33:47] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 11:33:54,860 - INFO - Handling login request
2024-11-27 11:33:54,886 - INFO - User scout logged in with role 侦查者
2024-11-27 11:33:54,892 - INFO - 169.254.201.64 - - [27/Nov/2024 11:33:54] "POST /login HTTP/1.1" 302 -
2024-11-27 11:33:54,920 - INFO - Accessing scout page
2024-11-27 11:33:54,927 - INFO - Notifications fetched: ()
2024-11-27 11:33:54,939 - INFO - 169.254.201.64 - - [27/Nov/2024 11:33:54] "GET /scout HTTP/1.1" 200 -
2024-11-27 11:33:55,055 - INFO - 169.254.201.64 - - [27/Nov/2024 11:33:55] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 11:42:58,189 - INFO - 169.254.55.92 - - [27/Nov/2024 11:42:58] "GET / HTTP/1.1" 200 -
2024-11-27 11:42:58,278 - INFO - 169.254.55.92 - - [27/Nov/2024 11:42:58] "GET /static/login.css HTTP/1.1" 200 -
2024-11-27 11:42:58,758 - INFO - 169.254.55.92 - - [27/Nov/2024 11:42:58] "GET /favicon.ico HTTP/1.1" 404 -
2024-11-27 11:43:21,513 - INFO - Handling login request
2024-11-27 11:43:21,532 - INFO - User admin logged in with role 指挥者
2024-11-27 11:43:21,539 - INFO - 169.254.55.92 - - [27/Nov/2024 11:43:21] "POST /login HTTP/1.1" 302 -
2024-11-27 11:43:21,569 - INFO - Accessing commander page
2024-11-27 11:43:21,574 - ERROR - Error accessing directory: [WinError 3] 系统找不到指定的路径。: 'E:/_Ufo/0000jiegou/TheBattleCar/uploads'
2024-11-27 11:43:21,605 - ERROR - Failed to decrypt message:
2024-11-27 11:43:21,605 - ERROR - Failed to decrypt message:
2024-11-27 11:43:21,625 - ERROR - Failed to decrypt message:
2024-11-27 11:43:21,656 - INFO - 169.254.55.92 - - [27/Nov/2024 11:43:21] "GET /commander HTTP/1.1" 200 -
2024-11-27 11:43:33,340 - INFO - 169.254.55.92 - - [27/Nov/2024 11:43:33] "GET / HTTP/1.1" 200 -
2024-11-27 11:43:48,530 - INFO - Handling login request
2024-11-27 11:43:48,556 - INFO - User scout logged in with role 侦查者
2024-11-27 11:43:48,561 - INFO - 169.254.55.92 - - [27/Nov/2024 11:43:48] "POST /login HTTP/1.1" 302 -
2024-11-27 11:43:48,593 - INFO - Accessing scout page
2024-11-27 11:43:48,609 - INFO - Notifications fetched: ()
2024-11-27 11:43:48,609 - INFO - 169.254.55.92 - - [27/Nov/2024 11:43:48] "GET /scout HTTP/1.1" 200 -
2024-11-27 11:43:48,734 - INFO - 169.254.55.92 - - [27/Nov/2024 11:43:48] "GET /static/login.css HTTP/1.1" 304 -
2024-11-27 11:46:38,840 - INFO - 169.254.100.1 - - [27/Nov/2024 11:46:38] "GET / HTTP/1.1" 200 -
2024-11-27 11:46:38,943 - INFO - 169.254.100.1 - - [27/Nov/2024 11:46:38] "GET /static/login.css HTTP/1.1" 200 -
2024-11-27 11:46:39,555 - INFO - 169.254.100.1 - - [27/Nov/2024 11:46:39] "GET /favicon.ico HTTP/1.1" 404 -
2024-11-27 11:46:52,645 - INFO - Handling login request
2024-11-27 11:46:52,677 - INFO - User scout logged in with role 侦查者
2024-11-27 11:46:52,683 - INFO - 169.254.100.1 - - [27/Nov/2024 11:46:52] "POST /login HTTP/1.1" 302 -
2024-11-27 11:46:52,711 - INFO - Accessing scout page
2024-11-27 11:46:52,713 - INFO - Notifications fetched: ()
2024-11-27 11:46:52,719 - INFO - 169.254.100.1 - - [27/Nov/2024 11:46:52] "GET /scout HTTP/1.1" 200 -
2024-11-27 11:46:52,761 - INFO - 169.254.100.1 - - [27/Nov/2024 11:46:52] "GET /static/login.css HTTP/1.1" 304 -

@ -37,7 +37,7 @@ def decrypt_message(encrypted_message):
key = load_key()
f = Fernet(key)
try:
print(f"Encrypted message: {encrypted_message}")
#print(f"Encrypted message: {encrypted_message}")
decrypted_message = f.decrypt(encrypted_message).decode()
return decrypted_message
except (InvalidToken, ValueError) as e:
@ -197,7 +197,7 @@ def login():
user_data = cursor.fetchone()
cursor.close()
# print(user_data['password'].encode('utf-8'))
print(user_data)
#print(user_data)
if user_data:
# 解密密码
decrypted_password = decrypt_message(user_data['password'].encode('utf-8'))
@ -217,7 +217,7 @@ def login():
logger.warning("Invalid password")
flash("Invalid password. Please try again.")
else:
print(1)
#print(1)
logger.warning("Invalid username")
return "Invalid username. Please try again."

Binary file not shown.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,75 @@
import re
import random
def generate_valid_latitude():
# 生成有效的纬度坐标 (0°-90°)
latitude_degree = random.randint(0, 90)
latitude_minute = random.randint(0, 59)
latitude_second = random.randint(0, 59)
latitude_direction = random.choice(['N', 'S'])
return f"{latitude_degree}°{latitude_minute}{latitude_second}{latitude_direction}"
def generate_valid_longitude():
# 生成有效的经度坐标 (0°-180°)
longitude_degree = random.randint(0, 180)
longitude_minute = random.randint(0, 59)
longitude_second = random.randint(0, 59)
longitude_direction = random.choice(['E', 'W'])
return f"{longitude_degree}°{longitude_minute}{longitude_second}{longitude_direction}"
def generate_invalid_latitude():
# 生成错误的纬度坐标 (超过90°或负值)
latitude_degree = random.randint(91, 180)
latitude_minute = random.randint(0, 59)
latitude_second = random.randint(0, 59)
latitude_direction = random.choice(['N', 'S'])
return f"{latitude_degree}°{latitude_minute}{latitude_second}{latitude_direction}"
def generate_invalid_longitude():
# 生成错误的经度坐标 (超过180°或负值)
longitude_degree = random.randint(181, 360)
longitude_minute = random.randint(0, 59)
longitude_second = random.randint(0, 59)
longitude_direction = random.choice(['E', 'W'])
return f"{longitude_degree}°{longitude_minute}{longitude_second}{longitude_direction}"
def generate_invalid_coordinate():
# 随机决定生成哪种类型的错误坐标
if random.choice([True, False]):
# 纬度正确,经度错误
return f"{generate_valid_latitude()},{generate_invalid_longitude()}"
else:
# 纬度错误,经度正确
return f"{generate_invalid_latitude()},{generate_valid_longitude()}"
def insert_invalid_coordinates(file_path, num_invalid_coords):
# 读取文件内容
with open(file_path, 'r', encoding='utf-8') as file:
original_content = file.read()
# 正则表达式匹配现有的经纬度坐标
pattern = r'(\d{1,2}°[0-5]?\d[0-5]?\d″[NS]),(\d{1,3}°[0-5]?\d[0-5]?\d″[WE])'
matches = re.findall(pattern, original_content)
# 将现有的坐标转换为字符串列表
valid_coords = [f"{match[0]},{match[1]}" for match in matches]
# 生成并插入错误坐标
invalid_coords = [generate_invalid_coordinate() for _ in range(num_invalid_coords)]
all_coords = valid_coords + invalid_coords
# 打乱所有坐标的顺序
random.shuffle(all_coords)
# 写回文件
with open(file_path, 'w', encoding='utf-8') as file:
file.write("\n".join(all_coords))
# 指定文件路径和要插入的错误坐标数量
file_path = r"E:\_Ufo\000jiegou\TheBattleCar\coordinate.txt"
num_invalid_coords = 1000
# 插入错误坐标
insert_invalid_coordinates(file_path, num_invalid_coords)
print(f"已成功将 {num_invalid_coords} 个错误坐标插入到 {file_path} 文件中。")

@ -0,0 +1,33 @@
import re
def parse_coordinates(file_path):
valid_coordinates = []
with open(file_path, 'r', encoding='utf-8') as file:
for line in file:
match = re.match(r'(\d+°\d+\d+″[NS]),(\d+°\d+\d+″[EW])', line.strip())
if match:
lat, lon = match.groups()
lat_value = parse_dms(lat)
lon_value = parse_dms(lon)
if -90 <= lat_value <= 90 and -180 <= lon_value <= 180:
valid_coordinates.append((lat, lon))
return valid_coordinates
def parse_dms(dms):
parts = re.split('[°′″]', dms)
degrees = int(parts[0])
minutes = int(parts[1])
seconds = float(parts[2])
direction = parts[3]
total_degrees = degrees + minutes / 60 + seconds / 3600
if direction in ['S', 'W']:
total_degrees = -total_degrees
return total_degrees
file_path = 'e:\\_Ufo\\000jiegou\\TheBattleCar\\coordinate.txt'
valid_coords = parse_coordinates(file_path)
for coord in valid_coords:
print(coord)

@ -38,7 +38,7 @@
<body>
<div class="login">
<h2>侦查者</h2>
<button onclick="window.location.href='http://192.168.146.178:5000/'" class="register-button">控制小车</button>
<button onclick="window.location.href='http://169.254.142.1:5000/'" class="register-button">控制小车</button>
<button onclick="window.location.href='{{ url_for('send_message') }}'" class="register-button">发送消息</button>
<h2>通知</h2>

Loading…
Cancel
Save