From acfc7e547ece1cfc61ff2b36951c04c1d15e3763 Mon Sep 17 00:00:00 2001 From: Lukas Martin Date: Wed, 31 Aug 2022 03:30:20 +0200 Subject: [PATCH] Initial Commit --- .idea/.gitignore | 8 +++ .idea/inspectionProfiles/Project_Default.xml | 26 ++++++++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/jsLibraryMappings.xml | 6 ++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 +++ .idea/placesvisited.iml | 22 ++++++ __pycache__/app.cpython-310.pyc | Bin 0 -> 1436 bytes app.py | 44 ++++++++++++ static/js/index.js | 4 ++ static/styles/index.css | 3 + static/styles/map_stylesheet.css | 12 ++++ templates/index.html | 41 ++++++++++++ templates/interactiv_map.html | 17 +++++ templates/map.html | 63 ++++++++++++++++++ 15 files changed, 264 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/jsLibraryMappings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/placesvisited.iml create mode 100644 __pycache__/app.cpython-310.pyc create mode 100644 app.py create mode 100644 static/js/index.js create mode 100644 static/styles/index.css create mode 100644 static/styles/map_stylesheet.css create mode 100644 templates/index.html create mode 100644 templates/interactiv_map.html create mode 100644 templates/map.html diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..9c3f4e8 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,26 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..4adae72 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4ce400f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..d8545b8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/placesvisited.iml b/.idea/placesvisited.iml new file mode 100644 index 0000000..3305c8a --- /dev/null +++ b/.idea/placesvisited.iml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/__pycache__/app.cpython-310.pyc b/__pycache__/app.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..abdfb8d338faae18de6a251b214948b410f5689a GIT binary patch literal 1436 zcmZ`(O>f*b5G5r_tJUs${ShZ=i>5(ORSP)xA}DG!E_#TaB6co<0YMSzt!znDhg`Qd zHYewr{s#M)OMehg1$yc^w;bBe(01bhDFF^gLvm)`yrJ}Dk}@2B{I*nmB^djYK5mW> zKfc9jen%mhjwxqZPfi(uE!Z2d3HnPstyzHdr%c z8u9_^m6i(4!s=f-m-wApcdr?cgSTHk`g(s>+oA`3h$)->qq2P7?<2TMnd92jR>}Rc z?>G7rH=QY4R9b^1Aj%N!1{r557aW#RsVKYaK|3^kwqKxP*&*h+2xh?oyWmyuB3y*$ zfebD%#4_cfyp%3Sx8t0~DEXf;=I9WWdg)a>GV<2prWsB`24+eNisO6z{o&{1muPUuKL# z@R$cY{yP<84tLRTDkz-_wf6>bMabVIC@kXj$by~IwYswk%F5Qqc|jeT>$Z8~*_#5-bx8xDNU{wtgtdT6~i_H(@ByLB9l`Iz6u3HQLla3Q`I7gxGF zsAn)DFZ4D%5Ep@-BmG1wd`5z*?F40cnNkSz?!!zyY_*&>>Kpna7=m=4C5R*mQl9c8 QOrm6ntGJrUn2Ue@1y$=lq5uE@ literal 0 HcmV?d00001 diff --git a/app.py b/app.py new file mode 100644 index 0000000..e6a42e3 --- /dev/null +++ b/app.py @@ -0,0 +1,44 @@ +from flask import Flask, render_template, Response, request, redirect, url_for +import folium +from geopy.geocoders import Nominatim + +app = Flask(__name__) +app.config["TEMPLATES_AUTO_RELOAD"] = True +geolocator = Nominatim(user_agent="MyApp") + + +def get_coordinates(town): + location = geolocator.geocode(town) + return location + + +def save_map(zoom, latitude, longitude): + map_folium = folium.Map( + location=[latitude, longitude], + zoom_start=zoom + ) + map_folium.save('templates/map.html') + return redirect(url_for("map_get")) + + +@app.route("/map") +def map_get(): + return render_template("interactiv_map.html") + + +@app.get('/') +def base_get(): + return render_template("index.html") + + +@app.post('/') +def base_post(): + zoom = request.form.get("zoom") + town = request.form.get("town") + if zoom and town is not None: + save_map(zoom, get_coordinates(town).latitude, get_coordinates(town).longitude) + return redirect(url_for("map_get")) + + +if __name__ == '__main__': + app.run() diff --git a/static/js/index.js b/static/js/index.js new file mode 100644 index 0000000..97d0148 --- /dev/null +++ b/static/js/index.js @@ -0,0 +1,4 @@ +function onButtonClick() { + let zoom = document.getElementById('submit_zoom').value; + console.log(zoom) +} \ No newline at end of file diff --git a/static/styles/index.css b/static/styles/index.css new file mode 100644 index 0000000..f760198 --- /dev/null +++ b/static/styles/index.css @@ -0,0 +1,3 @@ +body { + background-color: #252526; +} \ No newline at end of file diff --git a/static/styles/map_stylesheet.css b/static/styles/map_stylesheet.css new file mode 100644 index 0000000..5a58d5f --- /dev/null +++ b/static/styles/map_stylesheet.css @@ -0,0 +1,12 @@ +#bg { + background-color: #252526; +} + +#map { + margin: auto auto auto auto; + + width: 80%; + height: 800px; + border: 2px solid red; + float: left; +} diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..0ee03a4 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,41 @@ + + + + + + + Title + + + +
+

Test

+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+ + + \ No newline at end of file diff --git a/templates/interactiv_map.html b/templates/interactiv_map.html new file mode 100644 index 0000000..83b2c72 --- /dev/null +++ b/templates/interactiv_map.html @@ -0,0 +1,17 @@ + + + + + + Map + + + + +
+ {% include "map.html" %} +
+ + + + \ No newline at end of file diff --git a/templates/map.html b/templates/map.html new file mode 100644 index 0000000..026bb7f --- /dev/null +++ b/templates/map.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file