File: wxs.py

package info (click to toggle)
mapserver 7.0.4-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 16,264 kB
  • sloc: ansic: 172,418; cpp: 57,449; python: 2,972; xml: 1,676; cs: 997; yacc: 855; lex: 758; java: 588; perl: 428; makefile: 380; sh: 196; tcl: 158; ruby: 55
file content (31 lines) | stat: -rw-r--r-- 890 bytes parent folder | download | duplicates (5)
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
import mapscript

map = mapscript.mapObj('../../tests/test.map')
map.setMetaData( "ows_onlineresource", "http://dummy.org/" )
ows_req = mapscript.OWSRequest()

ows_req.type = mapscript.MS_GET_REQUEST

ows_req.setParameter( "SERVICE", "WMS" );
ows_req.setParameter( "VERSION", "1.1.0" );
ows_req.setParameter( "REQUEST", "GetCapabilities" );

mapscript.msIO_installStdoutToBuffer()
dispatch_status = map.OWSDispatch(ows_req)
if dispatch_status:
    status = '200 OK'
else:
    status = '500 Internal Server Error'
content_type = mapscript.msIO_stripStdoutBufferContentType()
mapscript.msIO_stripStdoutBufferContentHeaders()
result = mapscript.msIO_getStdoutBufferBytes()

try:
    # MapServer 6.0:
    mapscript.msCleanup()
except:
    # MapServer 6.1:
    mapscript.msCleanup(1)

response_headers = [('Content-Type', content_type),
                    ('Content-Length', str(len(result)))]