正在显示
5 个修改的文件
包含
435 行增加
和
7 行删除
... | ... | @@ -8,7 +8,7 @@ from ..models import Table,Columns,DES |
8 | 8 | from app.util.component.ApiTemplate import ApiTemplate |
9 | 9 | from app.util.component.ModelVisitor import ModelVisitor |
10 | 10 | from app.util.component.PGUtil import PGUtil |
11 | -from osgeo.ogr import DataSource,Layer | |
11 | +from osgeo.ogr import DataSource,Layer,Feature | |
12 | 12 | from osgeo.osr import SpatialReference |
13 | 13 | class Api(ApiTemplate): |
14 | 14 | api_name = "表信息" |
... | ... | @@ -19,7 +19,7 @@ class Api(ApiTemplate): |
19 | 19 | table = Table.query.filter_by(guid=table_guid).one_or_none() |
20 | 20 | if not table: |
21 | 21 | raise Exception("数据不存在!") |
22 | - pg_ds = PGUtil.open_pg_data_source(0,DES.decode(table.relate_database.sqlalchemy_uri)) | |
22 | + pg_ds :DataSource = PGUtil.open_pg_data_source(0,DES.decode(table.relate_database.sqlalchemy_uri)) | |
23 | 23 | layer:Layer = pg_ds.GetLayerByName(table.name) |
24 | 24 | if not layer: |
25 | 25 | raise Exception("数据异常!") |
... | ... | @@ -27,10 +27,17 @@ class Api(ApiTemplate): |
27 | 27 | if layer: |
28 | 28 | sr:SpatialReference = layer.GetSpatialRef() |
29 | 29 | |
30 | - if sr: | |
31 | - append_dict["srid"] = sr.GetAuthorityCode(None) | |
30 | + if sr is not None: | |
32 | 31 | append_dict["sr_wkt"] = sr.ExportToWkt() |
33 | 32 | append_dict["sr_proj4"] = sr.ExportToProj4() |
33 | + | |
34 | + srid_sql = '''select st_srid({}) from public."{}" limit 1'''.format(layer.GetGeometryColumn(),layer.GetName()) | |
35 | + srid_layer:Layer = pg_ds.ExecuteSQL(srid_sql) | |
36 | + srid_feature : Feature = srid_layer.GetNextFeature() | |
37 | + if srid_feature: | |
38 | + if srid_feature.GetField(0): | |
39 | + append_dict["srid"] = str(srid_feature.GetField(0)) | |
40 | + | |
34 | 41 | else: |
35 | 42 | append_dict["exist"]=0 |
36 | 43 | columns = table.relate_columns.order_by(Columns.name).all() | ... | ... |
... | ... | @@ -13,6 +13,7 @@ from app.util.component.GeometryAdapter import GeometryAdapter |
13 | 13 | from app.util.component.StructurePrint import StructurePrint |
14 | 14 | |
15 | 15 | from osgeo.ogr import DataSource,Layer |
16 | +from osgeo.osr import SpatialReference | |
16 | 17 | |
17 | 18 | from app.util.component.VacuateConf import VacuateConf |
18 | 19 | import copy |
... | ... | @@ -65,6 +66,7 @@ class Api(ApiTemplate): |
65 | 66 | p_y = (extent[3] - extent[2]) / 5.0 |
66 | 67 | fill_precent = 0 |
67 | 68 | StructurePrint().print("判断疏密") |
69 | + | |
68 | 70 | for ix in range(5): |
69 | 71 | for iy in range(5): |
70 | 72 | grid_extent = [extent[0] + ix * p_x, extent[0] + ix * p_x + p_x, extent[2] + iy * p_y, |
... | ... | @@ -72,8 +74,9 @@ class Api(ApiTemplate): |
72 | 74 | |
73 | 75 | poly = GeometryAdapter.envelop_2_polygon(grid_extent) |
74 | 76 | |
75 | - sql = '''select * from "{}" where st_intersects({},st_geogfromtext('{}')) limit 1'''.format(layer.GetName(), | |
76 | - layer.GetGeometryColumn(),poly.ExportToWkt()) | |
77 | + sql = '''select * from "{}" where st_intersects({},st_setsrid(st_geometryfromtext('{}'),st_srid({}))) limit 1'''.format(layer.GetName(), | |
78 | + layer.GetGeometryColumn(),poly.ExportToWkt(),layer.GetGeometryColumn()) | |
79 | + | |
77 | 80 | query_layer: Layer = pg_ds.ExecuteSQL(sql) |
78 | 81 | if query_layer.GetFeatureCount() == 1: |
79 | 82 | fill_precent += 4 | ... | ... |
httpd.conf
0 → 100644
1 | +# | |
2 | +# This is the main Apache HTTP server configuration file. It contains the | |
3 | +# configuration directives that give the server its instructions. | |
4 | +# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information. | |
5 | +# In particular, see | |
6 | +# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html> | |
7 | +# for a discussion of each configuration directive. | |
8 | +# | |
9 | +# Do NOT simply read the instructions in here without understanding | |
10 | +# what they do. They're here only as hints or reminders. If you are unsure | |
11 | +# consult the online docs. You have been warned. | |
12 | +# | |
13 | +# Configuration and logfile names: If the filenames you specify for many | |
14 | +# of the server's control files begin with "/" (or "drive:/" for Win32), the | |
15 | +# server will use that explicit path. If the filenames do *not* begin | |
16 | +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' | |
17 | +# with ServerRoot set to '/www' will be interpreted by the | |
18 | +# server as '/www/log/access_log', where as '/log/access_log' will be | |
19 | +# interpreted as '/log/access_log'. | |
20 | + | |
21 | +# | |
22 | +# ServerRoot: The top of the directory tree under which the server's | |
23 | +# configuration, error, and log files are kept. | |
24 | +# | |
25 | +# Do not add a slash at the end of the directory path. If you point | |
26 | +# ServerRoot at a non-local disk, be sure to specify a local disk on the | |
27 | +# Mutex directive, if file-based mutexes are used. If you wish to share the | |
28 | +# same ServerRoot for multiple httpd daemons, you will need to change at | |
29 | +# least PidFile. | |
30 | +# | |
31 | +ServerRoot "/etc/httpd" | |
32 | + | |
33 | +# | |
34 | +# Listen: Allows you to bind Apache to specific IP addresses and/or | |
35 | +# ports, instead of the default. See also the <VirtualHost> | |
36 | +# directive. | |
37 | +# | |
38 | +# Change this to Listen on specific IP addresses as shown below to | |
39 | +# prevent Apache from glomming onto all bound IP addresses. | |
40 | +# | |
41 | +#Listen 12.34.56.78:80 | |
42 | +Listen 80 | |
43 | +Listen 81 | |
44 | + | |
45 | +# | |
46 | +# Dynamic Shared Object (DSO) Support | |
47 | +# | |
48 | +# To be able to use the functionality of a module which was built as a DSO you | |
49 | +# have to place corresponding `LoadModule' lines at this location so the | |
50 | +# directives contained in it are actually available _before_ they are used. | |
51 | +# Statically compiled modules (those listed by `httpd -l') do not need | |
52 | +# to be loaded here. | |
53 | +# | |
54 | +# Example: | |
55 | +# LoadModule foo_module modules/mod_foo.so | |
56 | +# | |
57 | +Include conf.modules.d/*.conf | |
58 | + | |
59 | +# | |
60 | +# If you wish httpd to run as a different user or group, you must run | |
61 | +# httpd as root initially and it will switch. | |
62 | +# | |
63 | +# User/Group: The name (or #number) of the user/group to run httpd as. | |
64 | +# It is usually good practice to create a dedicated user and group for | |
65 | +# running httpd, as with most system services. | |
66 | +# | |
67 | +User apache | |
68 | +Group apache | |
69 | + | |
70 | +# 'Main' server configuration | |
71 | +# | |
72 | +# The directives in this section set up the values used by the 'main' | |
73 | +# server, which responds to any requests that aren't handled by a | |
74 | +# <VirtualHost> definition. These values also provide defaults for | |
75 | +# any <VirtualHost> containers you may define later in the file. | |
76 | +# | |
77 | +# All of these directives may appear inside <VirtualHost> containers, | |
78 | +# in which case these default settings will be overridden for the | |
79 | +# virtual host being defined. | |
80 | +# | |
81 | + | |
82 | +# | |
83 | +# ServerAdmin: Your address, where problems with the server should be | |
84 | +# e-mailed. This address appears on some server-generated pages, such | |
85 | +# as error documents. e.g. admin@your-domain.com | |
86 | +# | |
87 | +ServerAdmin root@localhost | |
88 | + | |
89 | +# | |
90 | +# ServerName gives the name and port that the server uses to identify itself. | |
91 | +# This can often be determined automatically, but we recommend you specify | |
92 | +# it explicitly to prevent problems during startup. | |
93 | +# | |
94 | +# If your host doesn't have a registered DNS name, enter its IP address here. | |
95 | +# | |
96 | +#ServerName www.example.com:80 | |
97 | + | |
98 | +# | |
99 | +# Deny access to the entirety of your server's filesystem. You must | |
100 | +# explicitly permit access to web content directories in other | |
101 | +# <Directory> blocks below. | |
102 | +# | |
103 | +<Directory /> | |
104 | + AllowOverride none | |
105 | + Require all denied | |
106 | +</Directory> | |
107 | + | |
108 | +# | |
109 | +# Note that from this point forward you must specifically allow | |
110 | +# particular features to be enabled - so if something's not working as | |
111 | +# you might expect, make sure that you have specifically enabled it | |
112 | +# below. | |
113 | +# | |
114 | + | |
115 | +# | |
116 | +# DocumentRoot: The directory out of which you will serve your | |
117 | +# documents. By default, all requests are taken from this directory, but | |
118 | +# symbolic links and aliases may be used to point to other locations. | |
119 | +# | |
120 | + | |
121 | + DocumentRoot "/var/www/html" | |
122 | +#DocumentRoot "/html" | |
123 | + | |
124 | +# | |
125 | +# Relax access to content within /var/www. | |
126 | +# | |
127 | +<Directory "/var/www"> | |
128 | + AllowOverride none | |
129 | + # Allow open access: | |
130 | + Require all denied | |
131 | +</Directory> | |
132 | + | |
133 | +# Further relax access to the default document root: | |
134 | +<Directory "/var/www/html"> | |
135 | + # | |
136 | + # Possible values for the Options directive are "None", "All", | |
137 | + # or any combination of: | |
138 | + # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews | |
139 | + # | |
140 | + # Note that "MultiViews" must be named *explicitly* --- "Options All" | |
141 | + # doesn't give it to you. | |
142 | + # | |
143 | + # The Options directive is both complicated and important. Please see | |
144 | + # http://httpd.apache.org/docs/2.4/mod/core.html#options | |
145 | + # for more information. | |
146 | + # | |
147 | + Options Indexes FollowSymLinks | |
148 | + | |
149 | + # | |
150 | + # AllowOverride controls what directives may be placed in .htaccess files. | |
151 | + # It can be "All", "None", or any combination of the keywords: | |
152 | + # Options FileInfo AuthConfig Limit | |
153 | + # | |
154 | + AllowOverride all | |
155 | + | |
156 | + # | |
157 | + # Controls who can get stuff from this server. | |
158 | + # | |
159 | + Require all granted | |
160 | +</Directory> | |
161 | + | |
162 | +# | |
163 | +# DirectoryIndex: sets the file that Apache will serve if a directory | |
164 | +# is requested. | |
165 | +# | |
166 | +<IfModule dir_module> | |
167 | + DirectoryIndex index.html | |
168 | +</IfModule> | |
169 | + | |
170 | +# | |
171 | +# The following lines prevent .htaccess and .htpasswd files from being | |
172 | +# viewed by Web clients. | |
173 | +# | |
174 | + | |
175 | +AccessFileName .htaccess | |
176 | + | |
177 | +<Files ".ht*"> | |
178 | + Require all denied | |
179 | +</Files> | |
180 | + | |
181 | +# | |
182 | +# ErrorLog: The location of the error log file. | |
183 | +# If you do not specify an ErrorLog directive within a <VirtualHost> | |
184 | +# container, error messages relating to that virtual host will be | |
185 | +# logged here. If you *do* define an error logfile for a <VirtualHost> | |
186 | +# container, that host's errors will be logged there and not here. | |
187 | +# | |
188 | +ErrorLog "logs/error_log" | |
189 | + | |
190 | +# | |
191 | +# LogLevel: Control the number of messages logged to the error_log. | |
192 | +# Possible values include: debug, info, notice, warn, error, crit, | |
193 | +# alert, emerg. | |
194 | +# | |
195 | +LogLevel warn | |
196 | + | |
197 | +<IfModule log_config_module> | |
198 | + # | |
199 | + # The following directives define some format nicknames for use with | |
200 | + # a CustomLog directive (see below). | |
201 | + # | |
202 | + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined | |
203 | + LogFormat "%h %l %u %t \"%r\" %>s %b" common | |
204 | + | |
205 | + <IfModule logio_module> | |
206 | + # You need to enable mod_logio.c to use %I and %O | |
207 | + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio | |
208 | + </IfModule> | |
209 | + | |
210 | + # | |
211 | + # The location and format of the access logfile (Common Logfile Format). | |
212 | + # If you do not define any access logfiles within a <VirtualHost> | |
213 | + # container, they will be logged here. Contrariwise, if you *do* | |
214 | + # define per-<VirtualHost> access logfiles, transactions will be | |
215 | + # logged therein and *not* in this file. | |
216 | + # | |
217 | + #CustomLog "logs/access_log" common | |
218 | + | |
219 | + # | |
220 | + # If you prefer a logfile with access, agent, and referer information | |
221 | + # (Combined Logfile Format) you can use the following directive. | |
222 | + # | |
223 | + CustomLog "logs/access_log" combined | |
224 | +</IfModule> | |
225 | + | |
226 | +<IfModule alias_module> | |
227 | + # | |
228 | + # Redirect: Allows you to tell clients about documents that used to | |
229 | + # exist in your server's namespace, but do not anymore. The client | |
230 | + # will make a new request for the document at its new location. | |
231 | + # Example: | |
232 | + # Redirect permanent /foo http://www.example.com/bar | |
233 | + | |
234 | + # | |
235 | + # Alias: Maps web paths into filesystem paths and is used to | |
236 | + # access content that does not live under the DocumentRoot. | |
237 | + # Example: | |
238 | + # Alias /webpath /full/filesystem/path | |
239 | + # | |
240 | + # If you include a trailing / on /webpath then the server will | |
241 | + # require it to be present in the URL. You will also likely | |
242 | + # need to provide a <Directory> section to allow access to | |
243 | + # the filesystem path. | |
244 | + | |
245 | + # | |
246 | + # ScriptAlias: This controls which directories contain server scripts. | |
247 | + # ScriptAliases are essentially the same as Aliases, except that | |
248 | + # documents in the target directory are treated as applications and | |
249 | + # run by the server when requested rather than as documents sent to the | |
250 | + # client. The same rules about trailing "/" apply to ScriptAlias | |
251 | + # directives as to Alias. | |
252 | + # | |
253 | + ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" | |
254 | + | |
255 | +</IfModule> | |
256 | + | |
257 | +# | |
258 | +# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased | |
259 | +# CGI directory exists, if you have that configured. | |
260 | +# | |
261 | +<Directory "/var/www/cgi-bin"> | |
262 | + AllowOverride None | |
263 | + Options None | |
264 | + Require all granted | |
265 | +</Directory> | |
266 | + | |
267 | +<IfModule mime_module> | |
268 | + # | |
269 | + # TypesConfig points to the file containing the list of mappings from | |
270 | + # filename extension to MIME-type. | |
271 | + # | |
272 | + TypesConfig /etc/mime.types | |
273 | + | |
274 | + # | |
275 | + # AddType allows you to add to or override the MIME configuration | |
276 | + # file specified in TypesConfig for specific file types. | |
277 | + # | |
278 | + #AddType application/x-gzip .tgz | |
279 | + # | |
280 | + # AddEncoding allows you to have certain browsers uncompress | |
281 | + # information on the fly. Note: Not all browsers support this. | |
282 | + # | |
283 | + #AddEncoding x-compress .Z | |
284 | + #AddEncoding x-gzip .gz .tgz | |
285 | + # | |
286 | + # If the AddEncoding directives above are commented-out, then you | |
287 | + # probably should define those extensions to indicate media types: | |
288 | + # | |
289 | + AddType application/x-compress .Z | |
290 | + AddType application/x-gzip .gz .tgz | |
291 | + | |
292 | + # | |
293 | + # AddHandler allows you to map certain file extensions to "handlers": | |
294 | + # actions unrelated to filetype. These can be either built into the server | |
295 | + # or added with the Action directive (see below) | |
296 | + # | |
297 | + # To use CGI scripts outside of ScriptAliased directories: | |
298 | + # (You will also need to add "ExecCGI" to the "Options" directive.) | |
299 | + # | |
300 | + #AddHandler cgi-script .cgi | |
301 | + | |
302 | + # For type maps (negotiated resources): | |
303 | + #AddHandler type-map var | |
304 | + | |
305 | + # | |
306 | + # Filters allow you to process content before it is sent to the client. | |
307 | + # | |
308 | + # To parse .shtml files for server-side includes (SSI): | |
309 | + # (You will also need to add "Includes" to the "Options" directive.) | |
310 | + # | |
311 | + AddType text/html .shtml | |
312 | + AddOutputFilter INCLUDES .shtml | |
313 | +</IfModule> | |
314 | + | |
315 | +# | |
316 | +# Specify a default charset for all content served; this enables | |
317 | +# interpretation of all content as UTF-8 by default. To use the | |
318 | +# default browser choice (ISO-8859-1), or to allow the META tags | |
319 | +# in HTML content to override this choice, comment out this | |
320 | +# directive: | |
321 | +# | |
322 | +AddDefaultCharset UTF-8 | |
323 | + | |
324 | +<IfModule mime_magic_module> | |
325 | + # | |
326 | + # The mod_mime_magic module allows the server to use various hints from the | |
327 | + # contents of the file itself to determine its type. The MIMEMagicFile | |
328 | + # directive tells the module where the hint definitions are located. | |
329 | + # | |
330 | + conf/magic | |
331 | +</IfModule> | |
332 | + | |
333 | +# | |
334 | +# Customizable error responses come in three flavors: | |
335 | +# 1) plain text 2) local redirects 3) external redirects | |
336 | +# | |
337 | +# Some examples: | |
338 | +#ErrorDocument 500 "The server made a boo boo." | |
339 | +#ErrorDocument 404 /missing.html | |
340 | +#ErrorDocument 404 "/cgi-bin/missing_handler.pl" | |
341 | +#ErrorDocument 402 http://www.example.com/subscription_info.html | |
342 | +# | |
343 | + | |
344 | +# | |
345 | +# EnableMMAP and EnableSendfile: On systems that support it, | |
346 | +# memory-mapping or the sendfile syscall may be used to deliver | |
347 | +# files. This usually improves server performance, but must | |
348 | +# be turned off when serving from networked-mounted | |
349 | +# filesystems or if support for these functions is otherwise | |
350 | +# broken on your system. | |
351 | +# Defaults if commented: EnableMMAP On, EnableSendfile Off | |
352 | +# | |
353 | +#EnableMMAP off | |
354 | +EnableSendfile on | |
355 | + | |
356 | +# Supplemental configuration | |
357 | +# | |
358 | +# Load config files in the "/etc/httpd/conf.d" directory, if any. | |
359 | + conf.d/*.conf | |
360 | +AccessFileName .htaccess | |
361 | +LoadModule wsgi_module "/usr/lib64/httpd/modules/mod_wsgi-py37.cpython-37m-x86_64-linux-gnu.so" | |
362 | +LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so | |
363 | + "/var/gdal" | |
364 | + | |
365 | +<VirtualHost *:81> | |
366 | + dmapmanager processes=1 threads=16 display-name=%{GROUP} | |
367 | + dmapmanager | |
368 | + On | |
369 | + %{GLOBAL} | |
370 | + / /usr/src/app/run.wsgi | |
371 | + <Directory /usr/> | |
372 | + Require all granted | |
373 | + </Directory> | |
374 | +</VirtualHost> | |
375 | + | |
376 | +<Directory /usr/> | |
377 | + Require all granted | |
378 | +</Directory> | ... | ... |
run.apache.sh
0 → 100644
1 | +#! /bin/sh | |
2 | +dn="dmapmanager" | |
3 | +#停止容器 | |
4 | +echo "正在关闭容器..." | |
5 | +docker stop $dn | |
6 | +docker rm $dn | |
7 | + | |
8 | +curPath=$(readlink -f $(dirname $0)) | |
9 | + | |
10 | + | |
11 | +#设置日志权限 | |
12 | +chmod -R 777 $curPath | |
13 | + | |
14 | +#设置端口 | |
15 | +port1="" | |
16 | +if [ ! -n "$1" ] ;then | |
17 | +port1="8830" | |
18 | +echo "未设置端口,使用默认8830端口..." | |
19 | +else | |
20 | +port1=$1 | |
21 | +echo "端口设置为$1 ..." | |
22 | +fi | |
23 | + | |
24 | +#设置端口 | |
25 | +port2="" | |
26 | +if [ ! -n "$2" ] ;then | |
27 | +port2="8840" | |
28 | +echo "未设置端口,使用默认8840端口..." | |
29 | +else | |
30 | +port2=$2 | |
31 | +echo "端口设置为$2 ..." | |
32 | +fi | |
33 | + | |
34 | +#启动容器和apache | |
35 | +echo "正在启动容器..." | |
36 | +set="--privileged=true -e TZ="Asia/Shanghai" --restart=always -e ALLOW_IP_RANGE=0.0.0.0/0" | |
37 | +docker run -d --name $dn $set -p $port1:80 -p $port2:81 -v $curPath/logs/apache.error:/var/log/httpd/error_log -v ${curPath}/html:/var/www/html -v $curPath:/usr/src/app -v $curPath/httpd.conf:/etc/httpd/conf/httpd.conf dci/dmapmanager:4.1-gdb | |
38 | +sleep 1 | |
39 | +curl localhost:$port2/release | |
40 | + | ... | ... |
请
注册
或
登录
后发表评论