Skip to content

Make map download less misleading #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dkroutingtool/src/py/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ def download(session_id: str=''):

@app.get('/request_map/')
def request_map(minlat, minlon, maxlat, maxlon):
stateful_info['bounding_box'] = [minlat, minlon, maxlat, maxlon]


request_template = f'''
[out:xml]
[bbox:{minlon},{minlat}, {maxlon}, {maxlat}];
Expand All @@ -171,6 +170,7 @@ def request_map(minlat, minlon, maxlat, maxlon):
opened.write(r.text)
os.environ['osm_filename'] = 'ui_map'
temporary_build_profiles()
stateful_info['bounding_box'] = [minlat, minlon, maxlat, maxlon]
return {'message': 'Done'}


Expand Down Expand Up @@ -220,4 +220,4 @@ def temporary_build_profiles(osmpbf=False):


if __name__ == '__main__':
uvicorn.run(app, host='0.0.0.0', port=5001)
uvicorn.run(app, host='0.0.0.0', port=5001)
7 changes: 6 additions & 1 deletion dkroutingtool/src/py/ui/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,11 @@ def main():

if bound_check(tuple(bounding_box), old_bounding_box):
st.write(':heavy_check_mark: The currently available map covers the desired area, no need to redownload it unless you edited OSM since the last download')
elif area < 0.2 and 'alreadydownloaded' not in st.session_state:
st.session_state['alreadydownloaded'] = True
with st.spinner("Downloading the road network. Please wait..."):
request_map(bounding_box)
st.rerun()
else:
st.error(f"It would be recommended to download the area as you have locations in your input data outside the currently downloaded area. The size is {round(area,2)} in Cartesian square units, be mindful that values above 0.2 may lead to the download taking many minutes")

Expand Down Expand Up @@ -744,4 +749,4 @@ def update_data():


if __name__ == '__main__':
main()
main()