image_wms.py
1.8 KB
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
# coding=utf-8
#author: 4N
#createtime: 2021/3/24
#email: nheweijun@sina.com
from app.util.component.ApiTemplate import ApiTemplate
from threading import Thread
from .util.ImageWMSServer import ImageWMSServer
class Api(ApiTemplate):
api_name = "WMS"
def __init__(self,service_name):
super().__init__()
self.service_name = service_name
def process(self):
try:
instance = ImageWMSServer()
response = instance.wms(self.service_name,self.para)
except Exception as e:
raise e
return response
api_doc = {
"tags": ["影像接口"],
"parameters": [
{"name": "request",
"in": "query",
"type": "string",
"enum":["GetMap","GetCapabilities"]},
{"name": "bbox",
"in": "query",
"type": "string"},
{"name": "width",
"in": "query",
"type": "string"},
{"name": "height",
"in": "query",
"type": "string"},
{"name": "format",
"in": "query",
"type": "string"},
{"name": "quality",
"in": "query",
"type": "string"}
],
"responses": {
200: {
"schema": {
"properties": {
}
}
}
}
}
class MyThread(Thread):
def __init__(self,func,args=()):
super(MyThread,self).__init__()
self.func = func
self.args = args
def run(self):
self.result = self.func(*self.args)
def get_result(self):
try:
return self.result
except Exception:
return None