This commit is contained in:
parent
c9a9fcf287
commit
82c6e87578
4 changed files with 49 additions and 16 deletions
|
@ -14,11 +14,13 @@ For a complete change history, see the SVN log.
|
|||
0.6.1 SVN
|
||||
---------
|
||||
|
||||
- OGCServer: Made lxml dependency optional (r986) (#303)
|
||||
|
||||
- Rasters: Handle rounding to allow better alignment of raster layers (r1079) (#295)
|
||||
|
||||
- AGG Renderer: Added option to control output JPEG quality (r1078) (#198)
|
||||
|
||||
- Plugins: Fixed segfault in OGC Plugin with empty geometries (r1074) (#292)
|
||||
- Plugins: Fixed segfault in OGR Plugin with empty geometries (r1074) (#292)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -29,9 +29,16 @@ from StringIO import StringIO
|
|||
from copy import deepcopy
|
||||
from traceback import format_exception, format_exception_only
|
||||
from sys import exc_info
|
||||
from lxml import etree as ElementTree
|
||||
import re
|
||||
import sys
|
||||
|
||||
try:
|
||||
from lxml import etree as ElementTree
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
except ImportError:
|
||||
import elementtree.ElementTree as ElementTree
|
||||
|
||||
# from elementtree import ElementTree
|
||||
# ElementTree._namespace_map.update({'http://www.opengis.net/wms': 'wms',
|
||||
# 'http://www.opengis.net/ogc': 'ogc',
|
||||
|
@ -316,22 +323,34 @@ class WMSBaseServiceHandler(BaseServiceHandler):
|
|||
writer = TextFeatureInfo()
|
||||
elif params['info_format'] == 'text/xml':
|
||||
writer = XMLFeatureInfo()
|
||||
for layerindex, layername in enumerate(params['query_layers']):
|
||||
if layername in params['layers']:
|
||||
if m.layers[layerindex].queryable:
|
||||
featureset = getattr(m, querymethodname)(layerindex, params['i'], params['j'])
|
||||
if featureset:
|
||||
writer.addlayer(m.layers[layerindex].name)
|
||||
if params['query_layers'] and params['query_layers'][0] == '__all__':
|
||||
for layerindex, layer in enumerate(m.layers):
|
||||
featureset = getattr(m, querymethodname)(layerindex, params['i'], params['j'])
|
||||
if featureset:
|
||||
writer.addlayer(layer.name)
|
||||
feat = featureset.next()
|
||||
while feat:
|
||||
writer.addfeature()
|
||||
for prop in feat.properties:
|
||||
writer.addattribute(prop[0], prop[1])
|
||||
feat = featureset.next()
|
||||
else:
|
||||
for layerindex, layername in enumerate(params['query_layers']):
|
||||
if layername in params['layers']:
|
||||
if m.layers[layerindex].queryable:
|
||||
featureset = getattr(m, querymethodname)(layerindex, params['i'], params['j'])
|
||||
if featureset:
|
||||
writer.addlayer(m.layers[layerindex].name)
|
||||
feat = featureset.next()
|
||||
while feat:
|
||||
writer.addfeature()
|
||||
for prop in feat.properties:
|
||||
writer.addattribute(prop[0], prop[1])
|
||||
feat = featureset.next()
|
||||
else:
|
||||
raise OGCException('Requested query layer "%s" is not marked queryable.' % layername, 'LayerNotQueryable')
|
||||
else:
|
||||
raise OGCException('Requested query layer "%s" is not marked queryable.' % layername, 'LayerNotQueryable')
|
||||
else:
|
||||
raise OGCException('Requested query layer "%s" not in the LAYERS parameter.' % layername)
|
||||
raise OGCException('Requested query layer "%s" not in the LAYERS parameter.' % layername)
|
||||
return Response(params['info_format'], str(writer))
|
||||
|
||||
def _buildMap(self, params):
|
||||
|
@ -476,10 +495,10 @@ class TextFeatureInfo:
|
|||
self.buffer = ''
|
||||
|
||||
def addlayer(self, name):
|
||||
self.buffer += '[%s]\n' % name
|
||||
self.buffer += '\n[%s]\n' % name
|
||||
|
||||
def addfeature(self):
|
||||
self.buffer += '\n'
|
||||
pass#self.buffer += '\n'
|
||||
|
||||
def addattribute(self, name, value):
|
||||
self.buffer += '%s=%s\n' % (name, str(value))
|
||||
|
@ -513,7 +532,7 @@ class XMLFeatureInfo:
|
|||
attname = ElementTree.Element('name')
|
||||
attname.text = name
|
||||
attvalue = ElementTree.Element('value')
|
||||
attvalue.text = value.unicode()
|
||||
attvalue.text = unicode(value)
|
||||
attribute.append(attname)
|
||||
attribute.append(attvalue)
|
||||
self.currentfeature.append(attribute)
|
||||
|
|
|
@ -25,9 +25,15 @@ from common import ParameterDefinition, Response, Version, ListFactory, \
|
|||
ColorFactory, CRSFactory, WMSBaseServiceHandler, CRS, \
|
||||
BaseExceptionHandler, Projection
|
||||
from exceptions import OGCException, ServerConfigurationError
|
||||
from lxml import etree as ElementTree
|
||||
from mapnik import Coord
|
||||
|
||||
try:
|
||||
from lxml import etree as ElementTree
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
except ImportError:
|
||||
import elementtree.ElementTree as ElementTree
|
||||
|
||||
class ServiceHandler(WMSBaseServiceHandler):
|
||||
|
||||
SERVICE_PARAMS = {
|
||||
|
|
|
@ -25,9 +25,15 @@ from common import ParameterDefinition, Response, Version, ListFactory, \
|
|||
ColorFactory, CRSFactory, CRS, WMSBaseServiceHandler, \
|
||||
BaseExceptionHandler, Projection, Envelope
|
||||
from exceptions import OGCException, ServerConfigurationError
|
||||
from lxml import etree as ElementTree
|
||||
from mapnik import Coord
|
||||
|
||||
try:
|
||||
from lxml import etree as ElementTree
|
||||
except ImportError:
|
||||
import xml.etree.ElementTree as ElementTree
|
||||
except ImportError:
|
||||
import elementtree.ElementTree as ElementTree
|
||||
|
||||
class ServiceHandler(WMSBaseServiceHandler):
|
||||
|
||||
SERVICE_PARAMS = {
|
||||
|
|
Loading…
Reference in a new issue