-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
63 lines (46 loc) · 1.67 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
import re
import json
import time
import threading
import schedule
from urllib.request import urlopen
from datetime import datetime, timedelta
from bs4 import BeautifulSoup
from flask import Flask, make_response, request
import random
import requests
import os
import geopandas as gpd
cur_dir = os.path.dirname(os.path.realpath(__file__))
Micro_Plates_and_Major_Fault_Zones = 'data/Micro_Plates_and_Major_Fault_Zones.geojson'
with open(Micro_Plates_and_Major_Fault_Zones, 'r', encoding='utf-8' ) as f:
Micro_Plates_and_Major_Fault_Zones = json.load(f)
Plate_Interface = 'data/Plate_Interface.geojson'
with open(Plate_Interface, 'r', encoding='utf-8') as f:
Plate_Interface = json.load(f)
Plate_Motion = 'data/Plate_Motion.geojson'
with open(Plate_Motion, 'r', encoding='utf-8') as f:
Plate_Motion = json.load(f)
app = Flask(__name__)
@app.route('/')
def index():
json_data = json.dumps({
"type" : "FeatureCollection" ,
"name" : "Micro Plates and Major Fault Zones" ,
"creative" : {
"Name": "Emin",
"Github" : "https://github.com/Peyxw",
"Gmail" : "eminnesatg@gmail.com",
"nickname" : "Peyxw"
},
"Micro_Plates_and_Major_Fault_Zones" : Micro_Plates_and_Major_Fault_Zones['features'],
"Plate_Interface" : Plate_Interface['features'],
"Plate_Motion" : Plate_Motion['features'],
}, sort_keys=False)
res = make_response(json_data)
res.headers['Content-Type'] = 'application/json'
res.headers['Access-Control-Allow-Origin'] = '*'
return res
print(Micro_Plates_and_Major_Fault_Zones,Plate_Interface,Plate_Motion)
if __name__ == '__main__':
app.run(debug=True)