commit acfc7e547ece1cfc61ff2b36951c04c1d15e3763 Author: Lukas Martin Date: Wed Aug 31 03:30:20 2022 +0200 Initial Commit 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 0000000..abdfb8d Binary files /dev/null and b/__pycache__/app.cpython-310.pyc differ 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