diff --git a/bindings/python/mapnik/ogcserver/common.py b/bindings/python/mapnik/ogcserver/common.py
index 6abee362d..c013f000b 100644
--- a/bindings/python/mapnik/ogcserver/common.py
+++ b/bindings/python/mapnik/ogcserver/common.py
@@ -83,7 +83,7 @@ class BaseServiceHandler:
finalparams = {}
for paramname, paramdef in self.SERVICE_PARAMS[requestname].items():
if paramname not in params.keys() and paramdef.mandatory:
- raise OGCException("Mandatory parameter '%s' missing from request." % paramname)
+ raise OGCException('Mandatory parameter "%s" missing from request.' % paramname)
elif paramname in params.keys():
try:
params[paramname] = paramdef.cast(params[paramname])
@@ -93,7 +93,7 @@ class BaseServiceHandler:
raise OGCException('Invalid value "%s" for parameter "%s".' % (params[paramname], paramname))
if paramdef.allowedvalues and params[paramname] not in paramdef.allowedvalues:
if not paramdef.fallback:
- raise OGCException("Parameter '%s' has an illegal value." % paramname)
+ raise OGCException('Parameter "%s" has an illegal value.' % paramname)
else:
finalparams[paramname] = paramdef.default
else:
@@ -262,11 +262,26 @@ class BaseExceptionHandler:
return Response(self.xmlmimetype, ElementTree.tostring(ogcexcetree))
def inimagehandler(self, code, message, params):
- im = new('L', (int(params['width']), int(params['height'])))
+ im = new('RGBA', (int(params['width']), int(params['height'])))
+ im.putalpha(new('1', (int(params['width']), int(params['height']))))
draw = Draw(im)
for count, line in enumerate(message.strip().split('\n')):
- draw.text((12,15*(count+1)), line, fill='#FFFFFF')
+ draw.text((12,15*(count+1)), line, fill='#000000')
fh = StringIO()
im.save(fh, PIL_TYPE_MAPPING[params['format']])
fh.seek(0)
- return Response(params['format'], fh.read())
\ No newline at end of file
+ return Response(params['format'], fh.read())
+
+ def blankhandler(self, code, message, params):
+ bgcolor = params.get('bgcolor', '#FFFFFF')
+ bgcolor.replace('0x', '#')
+ transparent = params.get('transparent', 'FALSE')
+ if transparent == 'TRUE':
+ im = new('RGBA', (int(params['width']), int(params['height'])))
+ im.putalpha(new('1', (int(params['width']), int(params['height']))))
+ else:
+ im = new('RGBA', (int(params['width']), int(params['height'])), bgcolor)
+ fh = StringIO()
+ im.save(fh, PIL_TYPE_MAPPING[params['format']])
+ fh.seek(0)
+ return Response(params['format'], fh.read())
diff --git a/bindings/python/mapnik/ogcserver/wms111.py b/bindings/python/mapnik/ogcserver/wms111.py
index f310effd6..0370468c5 100644
--- a/bindings/python/mapnik/ogcserver/wms111.py
+++ b/bindings/python/mapnik/ogcserver/wms111.py
@@ -94,6 +94,7 @@ class ServiceHandler(WMSBaseServiceHandler):
application/vnd.ogc.se_xml
application/vnd.ogc.se_inimage
+ application/vnd.ogc.se_blank
A Mapnik WMS Server
@@ -193,6 +194,7 @@ class ExceptionHandler(BaseExceptionHandler):
xpath = 'ServiceException'
handlers = {'application/vnd.ogc.se_xml': BaseExceptionHandler.xmlhandler,
- 'application/vnd.ogc.se_inimage': BaseExceptionHandler.inimagehandler}
+ 'application/vnd.ogc.se_inimage': BaseExceptionHandler.inimagehandler,
+ 'application/vnd.ogc.se_blank': BaseExceptionHandler.blankhandler}
defaulthandler = 'application/vnd.ogc.se_xml'
\ No newline at end of file
diff --git a/bindings/python/mapnik/ogcserver/wms130.py b/bindings/python/mapnik/ogcserver/wms130.py
index eb10395bf..553a49c17 100644
--- a/bindings/python/mapnik/ogcserver/wms130.py
+++ b/bindings/python/mapnik/ogcserver/wms130.py
@@ -100,6 +100,7 @@ class ServiceHandler(WMSBaseServiceHandler):
XML
INIMAGE
+ BLANK
A Mapnik WMS Server
@@ -212,6 +213,7 @@ class ExceptionHandler(BaseExceptionHandler):
xpath = '{http://www.opengis.net/ogc}ServiceException'
handlers = {'XML': BaseExceptionHandler.xmlhandler,
- 'INIMAGE': BaseExceptionHandler.inimagehandler}
+ 'INIMAGE': BaseExceptionHandler.inimagehandler,
+ 'BLANK': BaseExceptionHandler.blankhandler}
defaulthandler = 'XML'
\ No newline at end of file
diff --git a/docs/ogcserver/readme.txt b/docs/ogcserver/readme.txt
index 483d116ca..b874bd07a 100644
--- a/docs/ogcserver/readme.txt
+++ b/docs/ogcserver/readme.txt
@@ -18,9 +18,9 @@ Features/Caveats
- WMS 1.1.1 and 1.3.0
- CGI/FastCGI
-- GetCapabilities and GetMap support only
+- GetCapabilities and GetMap support only (NO GetFeatureInfo)
- GIF/JPEG/PNG output
-- XML error handling only
+- XML/INIMAGE/BLANK error handling
- No real layer metadata support yet
- No re-projection support