Opened 21 years ago

Closed 20 years ago

#486 closed defect (fixed)

produce warning when layer name has spaces

Reported by: bartvde@… Owned by: mapserverbugs
Priority: high Milestone:
Component: WMS Server Version: 4.1
Severity: normal Keywords:
Cc:

Description

Tom Kralidis [Burlington] wrote:
bartvde@xs4all.nl wrote:
 
I have encountered a potential problem with layer names
containing spaces. This will lead to invalid GML responses when requesting
GetFeatureInfo in the GML 
format.
 
What would be a good solution to overcome this?
 
  This can also be painful to parse for some who wish to process
GetFeatureInfo responses.   Suggest to abstract the GetFeatureInfo reponse
construct to not include data
as element names and / or attributes, yet values of said.
 i.e.
 <Layer name="Groningen kust vlakken 2002">
 <Feature>
 ...
 </Feature>
</Layer>
 ..Tom
  
 
 
But this is not valid GML, is it?  We are talking about the GML response format.
 Does GML (or WFS) provide 
a way to support spaces in feature type names?
 
  
a. when parsing the mapfile make sure no spaces are contained
in layer names (or is this too rigorous for applications not using GML?)
 
b. when generating the GML for GetFeatureInfo check the layer
names or check if the generated GML is valid and well-formed? If the GML is not
valid or not well-formed 
it is better to generate a WMS Exception I guess than generating invalid GML.
 
 
 
Replacing spaces with underscores in the layer names as we start processing a
WMS request might work but 
could cause confusion too. Another important note is that this change would have
to apply to the 
GetCapabilities and GetMap requests as well.
 
Perhaps we should just add a test and a <!-- WARNING --> comment in the
Capabilities if any layer contains 
spaces (the same way we produce warnings for other potential problems).  Then
it's up to the person setting 
up the server to make sure their layer names don't contain spaces.
 
I think the WARNING would be the best route.  If you agree then please file a
bug and I can easily add this 
in version 4.1
 
Daniel

Change History (2)

comment:1 by doug@…, 21 years ago

A warning is OK, but this is really only a problem if the layer will be used for
WMS or WFS and DUMP = TRUE. Having a space in a layer name is not a problem
unless the layer is queryable and is expected to return GML.

Perhaps as an alternative to a warning, the capabilities response could simply
set queryable="0" for layers with bad layer names. It can't do it, so it
shouldn't advertise it as a capability at all.

It would be nice to return an exception if someone tried to query it, but
perhaps that would happen automatically if it wasn't an advertised capability...

comment:2 by assefa, 20 years ago

Resolution: fixed
Status: newclosed
Warning is outputted in the capabilities when layer/group/map names have space 
in them. There is also a waring before invalid xml elements when doing a 
GetFeatureInfo(eg when the layer name has space in it, you would get  <!-- 
WARNING: The value 'Forests with space_feature' is not valid in a XML tag 
context. -->).
I think this is the scope of the bug. Marking it as Fixed. 
Note: See TracTickets for help on using tickets.