Initial Commit

main
Lukas Martin 4 years ago
commit acfc7e547e

8
.idea/.gitignore vendored

@ -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

@ -0,0 +1,26 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="E501" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N813" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="str.findnth" />
</list>
</option>
</inspection_tool>
</profile>
</component>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="file://$PROJECT_DIR$" libraries="{jquery}" />
</component>
</project>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (placesvisited)" project-jdk-type="Python SDK" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/placesvisited.iml" filepath="$PROJECT_DIR$/.idea/placesvisited.iml" />
</modules>
</component>
</project>

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="Flask">
<option name="enabled" value="true" />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="jquery" level="application" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/../placesvisited\templates" />
</list>
</option>
</component>
</module>

Binary file not shown.

@ -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()

@ -0,0 +1,4 @@
function onButtonClick() {
let zoom = document.getElementById('submit_zoom').value;
console.log(zoom)
}

@ -0,0 +1,3 @@
body {
background-color: #252526;
}

@ -0,0 +1,12 @@
#bg {
background-color: #252526;
}
#map {
margin: auto auto auto auto;
width: 80%;
height: 800px;
border: 2px solid red;
float: left;
}

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="/static/js/index.js"></script>
<link rel="stylesheet" href='/static/styles/index.css'/>
<title>Title</title>
</head>
<body>
<div id='container'>
<h3>Test</h3>
<form method="post">
<div>
<label for="zoom"></label>
<input
type="zoom"
id="zoom"
name="zoom"
placeholder="10"
/>
</div>
<div>
<label for="Town"></label>
<input
type="town"
id="town"
name="town"
placeholder="Groß-Gerau"
/>
</div>
<br>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href='/static/styles/map_stylesheet.css'/>
<title>Map</title>
</head>
<body id="bg">
<div id="map">
{% include "map.html" %}
</div>
</body>
</html>

@ -0,0 +1,63 @@
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.6.0/dist/leaflet.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_17adc0dc87bb20c185baafe563d404dd {
position: relative;
width: 100.0%;
height: 100.0%;
left: 0.0%;
top: 0.0%;
}
</style>
</head>
<body>
<div class="folium-map" id="map_17adc0dc87bb20c185baafe563d404dd" ></div>
</body>
<script>
var map_17adc0dc87bb20c185baafe563d404dd = L.map(
"map_17adc0dc87bb20c185baafe563d404dd",
{
center: [53.4165565, -2.2318734],
crs: L.CRS.EPSG3857,
zoom: "15",
zoomControl: true,
preferCanvas: false,
}
);
var tile_layer_af766e66c63f3dc3f0282dbdf7826909 = L.tileLayer(
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
{"attribution": "Data by \u0026copy; \u003ca href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e, under \u003ca href=\"http://www.openstreetmap.org/copyright\"\u003eODbL\u003c/a\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
).addTo(map_17adc0dc87bb20c185baafe563d404dd);
</script>
Loading…
Cancel
Save