-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.py
116 lines (106 loc) · 2.49 KB
/
index.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from flask import *
from connection import getData
from connection import connectionDB
from connection import disconnectDB
from flask import jsonify
import pandas as pd
from pprint import pprint
app = Flask(__name__)
layers_columns = [
{
"field": "Table",
"title": "FeatureClass",
"sortable": True,
},
{
"field": "Field", # which is the field's name of data key
"title": "F. Name", # display as the table header's name
"sortable": True,
},
{
"field": "Type",
"title": "F. Type",
"sortable": True,
}
]
styles_columns = [
{
"field": "Stylename",
"title": "Stylename",
"sortable": True,
},
{
"field": "Type",
"title": "Type",
"sortable": True,
},
{
"field": "Table",
"title": "FeatureClass",
"sortable": True,
},
{
"field": "Count",
"title": "Count",
"sortable": True,
}
]
rasters_columns = [
{
"field": "Table",
"title": "FeatureClass",
"sortable": True,
},
{
"field": "SS ID",
"title": "SS ID",
"sortable": True,
},
{
"field": "SSC ID",
"title": "SSC ID",
"sortable": True,
},
{
"field": "Notes",
"title": "Notes",
"sortable": True,
},
{
"field": "Title",
"title": "Title",
"sortable": True,
},
{
"field": "Creator",
"title": "Creator",
"sortable": True,
},
{
"field": "FirstYear",
"title": "FirstYear",
"sortable": True,
},
{
"field": "LastYear",
"title": "LastYear",
"sortable": True,
}
]
@app.route('/')
def index():
dbname = request.args.get('db')
if not dbname:
dbname = "ir_rio"
con = connectionDB(dbname)
databases_data, layers_data, styles_data, rasters_data = getData(con)
layers_df = pd.DataFrame(layers_data, columns=['Table','Field', 'Type'])
layers_df.set_index(['Table'], inplace=True)
styles_df = pd.DataFrame(styles_data, columns=['Table','Type', 'Stylename', 'Count'])
styles_df.set_index(['Table'], inplace=True)
rasters_df = pd.DataFrame(rasters_data, columns=['Table','SS ID', 'SSC ID', 'Notes', 'Title', 'Creator', 'FirstYear', 'LastYear'])
rasters_df.set_index(['Table'], inplace=True)
disconnectDB(con)
return render_template('table.html',dbname = dbname, data=styles_data, columns=styles_columns, layers_data=layers_data ,layers_columns=layers_columns, databases=databases_data, rasters_data=rasters_data, rasters_columns = rasters_columns)
if __name__ == "__main__":
app.run(debug=True)