-
-
Notifications
You must be signed in to change notification settings - Fork 384
MapServer as WMS client, spaces in layer names on upstream server not supported. #5232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ArcGIS server requires that space is url-encoded as "%20" but it does not accept space encoded as "+". There has been a ticket in the ESRI ticket tracker about accepting both "%20" and "+" because also the http standard accepts them both but the resolution was "won't fix". The issue code and description at ESRI was
|
Using your test layer, you can see the actual WMS GetMap request generated by MapServer through the commandline, by using the shp2img utility with the parameter "-all_debug 3", which shows that MapServer (testing with master) replaces the space with a "+" in the layer name:
|
In one of the threads above the user reports success just by removing the detection of the space and recompiling: https://lists.osgeo.org/pipermail/mapserver-users/2014-August/076879.html Seems like there could be some unintentional effects to taking that route, but... |
Bob, Tanya, Jukka, all, I've applied the change mentioned in that thread, and created a very "experimental" build of MS4W for our testing of this. http://www.ms4w.com/release/experimental/ms4w_3.1.3dev_experimental.zip I've now successfully used the following mapfile, with a space in the client layer name, to generate a map image:
This generated a valid map image of the tracts. And with "all_debug 3" switch for shp2img I can see the correct GetMap request generated by MapServer: Give it a try, such as with GeoMOOSE, and any other ways you can think this change may affect things. -jeff |
Any testing feedback? I notice that there were 3 downloads of the experimental build. |
Applied to branch-7-0 in b6fb921 , autotests updated in MapServer/msautotest_DEPRECATED@c54b0b9 |
While this is not an issue with mapserver per-se, and thus not a fix that should rightfully belong in a maintenance release, after discussion we decided that the risks of this fix were rather low, and that it solved a real inter-operability issue. Thus the inclusion in 7.0.1 instead of 7.2 |
interesting. Not sure why my pull request wasn't accepted. ok sorry for the noise, glad you all decided. |
Maybe because it was full of whitespace changes in areas unrelated to this fix ? |
ouch, ok you didn't let me know. k sorry for the noise. |
So, I got my Census layer to work, mostly. Thanks everyone!! One little follow on item though related to legends, that I figured I should ask about here is. I'm getting the "Parameter 'layers' contains unacceptable layer names." error when trying to call for a pass through legend graphic. My question is, is there another location in the code that is calling for a Legend graphic separately that also needs to be tweaked for the white space(s)? Thanks Just to complicate matters, I'mn actually calling for two different layers in my client WMS mapfile: "Census Tracts,Census Tracts Labels" |
Can you give some steps to reproduce? (in other words, how are you generating the legend graphic call) I believe it is the application/client-side that generates the GetLegendGraphic url, not MapServer (but I've been wrong before ha). If you explain how to reproduce, that makes it easier to understand. |
GetLegendGraphic call to (our) Mapserver that is a client to the Census Bobb
|
Trying to reproduce here, that is why I ask. How are you generating the GetLegendGraphic call? (can you tell me the steps so I can reproduce locally?) Example, use the following mapfile, then do this command, etc. |
Sorry, confusing. |
Here is a working GetLegendGraphic request for the layer "Census Tracts": |
Sounds like the failure is on @bblammo's server which is sitting in between his application and the census service. So the failure is an incoming GetLegendGraphic request to his Mapserver, not getting passed on to the Census server... |
In simple CGI mode, locally I am using the same test mapfile, with "Census Tracts" layer, and I get a blank white legend graphic from MapServer, no error. I wonder how to reproduce @bblammo's error of ""Parameter 'layers' contains unacceptable layer names." |
Oh!!! (save that file and name it "WMSServer.png" and open it, bingo, it is ArcGIS's "Parameter 'layers' contains unacceptable layer names" error) I have never used 2 layers in a single WMS client layer before. If you separate them into 2 layers this error will not occur. |
How would a MapServer generate a map image, for 2 layers at the same time, and combine that into one single Legend image? I think that is asking for magic :) |
I'm not sure how MapServer would handle a GetLegendGraphic request for multiple layers into one image, but I'll let others comment now. Hope my debugging helped others. |
Could it actually be that ArcGIS Server is the one with the problem, in handling multiple layer names with spaces? My local CGI viewer actually gives that error for the GetMap call. (the legend is blank, but it is the GetMap request that causes the error) Ok sorry for so many messages ha. |
To reproduce this issue:
(save that returned file as 'MapServer.png' and open it, to view the error image) |
Ah solved, it was a mistake in one of the names - "Census Tracts Labels" (tracts not tract). Now everything works (CGI mode, shp2img, and a proper blank legend image is returned). Likely @bblammo might have made same mistake. I think this ticket is closed now. working mapfile:
working request generated by MapServer: correct image returned by ArcGIS Server: |
@bblammo will have to confirm - his second issue was about GetLegendGraphic, but perhaps his expectation of requesting 2 images in one request was not a realistic one. |
The map image returns just fine. Just trying to figure out how to display Bobb
|
As I mentioned, MapServer returns the legend fine (well a blank image in my testing). Regarding a GetLegendGraphic call with a proper legend graphic returned from the remote WMS server, this is when I always turn to client side code (OpenLayers, GeoMOOSE, GeoExt,...) to generate a nice GetLegendGraphic call for each layer (notice I say each layer, not for 2 combined layers). I was trying to ask earlier what you are using to generate that GetLegendGraphic url. It's pretty simple in javascript once you have the layer name. You can get a proper GetLegendGraphic url by executing a GetCapabilities request, and opening it in your text editor and finding the layer you need, the GetLegendGraphic url is listed there, such as: |
If I understand correctly, he is making a GetLegendGraphic request to his Mapserver, which he is expecting Mapserver to pass on to the Census server. Somewhere in that passing, his request is failing, possibly due to Mapserver not correctly handling the passing of the name with spaces. But that is just how I'm reading the thread... |
Iowa just hoping there was a way to automate the legend call. We set up Bobb
|
That's it in nutshell. :c) Bobb
|
So it is possible when we 'fixed' the GetMap portion of Mapserver to work with spaces, we missed another location where GetLegendGraphic also needs a similar fix applied... |
Not by all my testing (above). I was trying to show that no errors are generated, in MapServer CGI mode with a legend (my images above with legends). I've never seen MapServer CGI generate a GetLegendGraphic properly from a remote WMS service by itself. Do you have other examples we can test (other WMS servers, no spaces in layers, simple short mapfile)? You might also want to bring this issue, with a short test mapfile (one small mapfile that does generate your GetLegendGraphic, and one that does not) maybe to the larger MapServer-users list, where it isn't just me answering ha. Not sure. |
@tchaddad definitely possible. I think it would help to have one tiny mapfile with one layer from a WMS service and steps to get a proper GetLegendGraphic. And maybe more eyes on this (mailing list). But I'm not sure. |
Yeah, I agree Jeff, a direct legend request is definitely working with a space in the name I'm not 100% certain, but I think "pass through" requests are possible using MapCache, so I can see why Bobb was trying to get this to work. I think I have a service where I can test this, will report back... |
I've updated the WMS Client document and included this same TIGER example with 2 layers, and also a note about the comma must not contain spaces around it. http://www.mapserver.org/ogc/wms_client.html#adding-a-wms-layer |
OK - after some testing, I think I can report 2 things:
` Parameter 'layers' contains unacceptable layer names. `What I can't determine is which server is returning the error (my local or the remote) |
I think the GetLegendGraphic conversation deserves it's own Issue. The GetMap original issue is clearly solved and appropriately closed. |
How about thinking for a while and making a list of all cases which may have the same issue?
I suppose that GetMap is using %20 uniformly in all places of the connection string as it is defined in a mapfile at LAYER level, for example if connection contains "&STYLES=style with spaces in name" or vendor parameters with spaces. A WFS feature type name with space is fundamentally an error but such names exist and it might be good to check the behaviour also with cascaded WFS layers
|
For more background see these threads:
http://osgeo-org.1560.x6.nabble.com/Allowing-spaces-in-layer-names-WMS-WFS-td5213960.html
https://lists.osgeo.org/pipermail/mapserver-users/2014-August/076870.html
https://lists.osgeo.org/pipermail/mapserver-users/2014-August/076886.html
Here is some minimal info on using the Census (Arc) server WMS, The server is using spaces in both the NAME and TITLE tags, which MapServer doesn't seem to want to push through.
So, as an example, using this WMS:
Specifically, two layers, “Census Tracts” and “Census Tracts Labels”
I can open each of these service calls in just about everything, except Mapserver as a WMS client. I’m assuming the problem is in how MapServer is sending it’s request.
I've tried encoding in the MapServer request string, as a "+", and " " and as "%02". These last two seem to work when directly hitting the WMS, but MapServer is not translating any of them through it's request.
Here is a test mapfile I was using:
Mapfile
The text was updated successfully, but these errors were encountered: