[mapserver-users] cascading wms and layer names encoding
Eichner, Andreas - SID-NLKM
Andreas.Eichner at sid.sachsen.de
Wed Jun 12 06:10:24 PDT 2013
> As to arcgis server it now has an option to use layer names
> as they appear
> in the map project, effectively making names equal to the
> titles, even if
> illegal. But seriously, I can't imagine why this restriction
> is in the wms
> spec... seems archaic to me...
Seems you never read it... It's defined as simple xs:string which is a
"... finite-length sequence of characters that match the Char production
from [XML 1.0 (Second Edition)]" whereby Char is defined as:
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] |
[#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character,
excluding the surrogate blocks, FFFE, and FFFF. */
or in other words: almost every character.
> Anyway, MapServer encoding layers also doesn't seem to make
> sense too...
It's the only way to get a valid URL. See RFC 1738 "Uniform Resource
Locators" why.
> METADATA
> wms_name "layer with understandable name, another layer"
>
> (...)
> And I make a request to MapServer, what it sends to the original WMS
server
> looks like:
>
http://..../WMSServer/request=getmap&*layers=layer%20with%20understandab
le%20name%2C%20another%20layer*&otherparams
According to the code, the ',' from the wms_name metadata won't be
encoded by mapserver. The problem with your example is probably the
first space after the comma which is treated as part of the second layer
name. Anyway, you can specify most of the static parts of the URL,
especially the LAYERS parameter directly in the CONNECTION string. So
you can try
LAYER
[...]
CONNECTIONTYPE WMS
CONNECTION
"http://..../WMSServer?LAYERS=layer+with+understandable+name,another+lay
er&"
Note: some servers, especially the ones you deal with are a bit pitty in
some details, so you should try a space both in hex encoded version %20
and the plus version. Funny things might happen when it comes to unicode
characters above 0x7F. If the capabilities document is UTF-8 encoded and
contains multibyte characters their URL encoding is the hexencoding of
the corresponding UTF-8 bytestream (with some caveats).
Using non-ASCII characters or those with a special meaning in URLs for
layer names is calling for trouble. A layer's name is for machines, it's
title is for humans.
HTH
More information about the MapServer-users
mailing list