Skip to content
Snippets Groups Projects
Commit ae562943 authored by Duchateau Fabien's avatar Duchateau Fabien
Browse files

version 0.12 - working

parent be8bf69d
No related branches found
No related tags found
No related merge requests found
...@@ -11,34 +11,13 @@ import os, json ...@@ -11,34 +11,13 @@ import os, json
from mapiris import model from mapiris import model
app = Flask(__name__) app = Flask(__name__)
url = 'http://127.0.0.1:8080' url = 'http://127.0.0.1:8081'
@app.route('/', defaults={'page': None}) @app.route('/', defaults={'page': None})
#@app.route('/<page>', methods=["GET", "POST"]) #@app.route('/<page>', methods=["GET", "POST"])
def index(page): def index(page):
print(page)
return render_template('index.html') return render_template('index.html')
"""
if page is not None:
return render_template(page)
else:
return render_template('index.html')
"""
"""
if request.method == "POST":
if page is None:
return render_template('index.html')
# TODO remove the next lines
elif page.find('recommendation.html') > -1: # there is an argument POST
return render_template('recommendation.html')
elif page.find('clustering.html') > -1: # there is an argument POST
return render_template('clustering.html')
else:
return render_template(page)
else: # to avoid : Method Not Allowed The method is not allowed for the requested URL.
return render_template('index.html')
"""
@app.route('/details-iris.html', methods=["GET"]) @app.route('/details-iris.html', methods=["GET"])
...@@ -107,5 +86,5 @@ if __name__ == '__main__': ...@@ -107,5 +86,5 @@ if __name__ == '__main__':
webbrowser.open_new(url) webbrowser.open_new(url)
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 # do not cache files, especially static files such as JS app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 # do not cache files, especially static files such as JS
app.secret_key = 's3k_5Et#fL45k_#ranD0m-(StuF7)' app.secret_key = 's3k_5Et#fL45k_#ranD0m-(StuF7)'
app.run(port=8080) # debug = True app.run(port=8081) # debug = True
...@@ -4,17 +4,20 @@ ...@@ -4,17 +4,20 @@
# model.py: methods for getting data from MongoDB (using mongiris) and transforming it # model.py: methods for getting data from MongoDB (using mongiris) and transforming it
# ============================================================================= # =============================================================================
from mongiris import Mongiris from mongiris.main import Mongiris
import re, json import re
import json
# connection to the IRIS collection in MongoDB # connection to the IRIS collection in MongoDB
db = Mongiris() db = Mongiris()
iris_collection = db.iris_collection iris_collection = db.collection_iris
db.init_connection() db.init_connection()
json_iris_indicator_code_to_label = 'static/data/dictionnaire-indicateurs.json' json_iris_indicator_code_to_label = 'static/data/dictionnaire-indicateurs.json'
def get_iris_for_polygon(lat1, lng1, lat2, lng2): def get_iris_for_polygon(lat1, lng1, lat2, lng2):
polygon = db.convert_geojson_box_to_polygon(lng1, lat1, lng2, lat2) #polygon = db.convert_geojson_box_to_polygon(lng1, lat1, lng2, lat2)
polygon = Mongiris.convert_geojson_box_to_polygon(lng1, lat1, lng2, lat2)
#iris = db.geo_within(iris_collection, polygon) #iris = db.geo_within(iris_collection, polygon)
iris = db.intersect(iris_collection, polygon) iris = db.intersect(iris_collection, polygon)
return iris return iris
......
<header class="mb-3"> <header class="mb-3">
<h1><img src="{{url_for('static', filename='img/favicon.png')}}">&emsp;mapiris</h1> <h1><a href="/"><img src="{{url_for('static', filename='img/favicon.png')}}"></a>&emsp;mapiris</h1>
<em>Un outil de visualisation des IRIS</em> <em>Un outil de visualisation des IRIS</em>
<hr> <hr>
</header> </header>
\ No newline at end of file
[metadata] [metadata]
name = mapiris name = mapiris
version = 0.1 version = 0.12
description = This package aims at searching and printing IRIS on a map. description = This package aims at searching and printing IRIS on a map.
author = Fabien Duchateau author = Fabien Duchateau
author_email = fabien.duchateau@univ-lyon1.fr author_email = fabien.duchateau@univ-lyon1.fr
...@@ -15,9 +15,9 @@ include_package_data = True ...@@ -15,9 +15,9 @@ include_package_data = True
zip_safe = False zip_safe = False
install_requires = install_requires =
flask >= 1.0.2 flask >= 1.0.2
mongiris >= 0.21 mongiris >= 0.3
dependency_links = dependency_links =
git+https://fduchate@gitlab.liris.cnrs.fr/fduchate/mongiris.git#egg=mongiris-0.21 git+https://fduchate@gitlab.liris.cnrs.fr/fduchate/mongiris.git#egg=mongiris-0.3
#[options.packages.find] #[options.packages.find]
#exclude = #exclude =
...@@ -27,9 +27,9 @@ dependency_links = ...@@ -27,9 +27,9 @@ dependency_links =
[options.package_data] [options.package_data]
# package_data is ignored when a MANIFEST.in is provided # package_data is ignored when a MANIFEST.in is provided
. = README.md, . = README.md,
mapiris/static = vizliris/static/** mapiris/static = mapiris/static/**
mapiris/templates = vizliris/templates/* mapiris/templates = mapiris/templates/*
mapiris/data = vizliris/data/** mapiris/data = mapiris/data/**
[bdist_wheel] [bdist_wheel]
universal = 1 universal = 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment