diff --git a/tasks/enduro-trails/prototype/app.py b/tasks/enduro-trails/prototype/app.py index 614506b..4a97680 100644 --- a/tasks/enduro-trails/prototype/app.py +++ b/tasks/enduro-trails/prototype/app.py @@ -252,14 +252,26 @@ async def get_tile(z: int, x: int, y: int): q_north = north + buf_y if z <= 7: - limit = 5000 + limit = 3000 elif z <= 9: - limit = 25000 + limit = 8000 elif z <= 11: - limit = 25000 + limit = 15000 else: limit = 25000 + # Минимальная длина трека по зуму — фильтруем мусор на низких зумах + if z <= 7: + min_length = 2000 + elif z == 8: + min_length = 500 + elif z == 9: + min_length = 200 + elif z == 10: + min_length = 50 + else: + min_length = 0 + try: conn = get_db() cur = conn.cursor() @@ -269,8 +281,9 @@ async def get_tile(z: int, x: int, y: int): FROM trails WHERE min_lon <= ? AND max_lon >= ? AND min_lat <= ? AND max_lat >= ? + AND (length_m >= ? OR length_m IS NULL) LIMIT ? - """, (q_east, q_west, q_north, q_south, limit)) + """, (q_east, q_west, q_north, q_south, min_length, limit)) trails_rows = cur.fetchall() cur.execute("""