moved from GitLab to GitHub manually

This commit is contained in:
j.mei7
2022-03-20 00:27:04 +01:00
commit fd207b4794
13 changed files with 167924 additions and 0 deletions

24
utils/search.py Normal file
View File

@@ -0,0 +1,24 @@
from sql.handle_sql import SqlHandler
from server import osmPath, dbPath
# Initalize global variables
sql = ""
def search(wayName, limit):
global sql
formattedWays = []
limit = int(limit)
sql = SqlHandler(dbPath, osmPath)
ways = sql.getWaysByNameWildcard(wayName)
for way in ways:
formattedWays.append({'id': way, 'name': sql.getNameOfWay(way) + " (" + str(way) + ")"})
del sql
if len(formattedWays) >= limit:
return formattedWays[:limit]
else:
return formattedWays