Geographic Information Systems Asked by Paul Kennedy on November 28, 2020
I am attempting to configure our internal GeoServer to cascade an external WMS server. The external server has some custom properties which need to be passed when making a call to that WMS.
http://externalwms.com/?VERSION=1.3.0&REQUEST=GetMap&LAYERS=ENC&CRS=EPSG:4326&BBOX=53.8,8.4,54.1,9.2&CSBOOL=384&CSVALUE=,,,,,3&WIDTH=1280&HEIGHT=800&FORMAT=image/png
as you can see, the custom properties are
&CSBOOL=384
&CSVALUE=,,,,,3
I am unsure how to configure our WMS service with these parameters so the remote service is called with them.
I tried adding them to the service definition / GetCapabilities without luck. it appears to ignore the additional parameters.
I then tried to configure in the layers but there is no clear place to add custom parameters.
How can I achieve this?
There is currently no way to add custom parameters from the user interface.
I can think of a couple of ways to work around it, but have not tried either of them in practice, it's just speculation.
If you have any control on the remote server, then you can probably force the parameters to be added by adding them in the GetMap/GetFeatureInfo backlinks contained in the capabilities document... I hope the WMS cascading code would honor them when put there.
In a similar way, maybe you can manually download once the capabilities document of the remote server, edit it to add the extra parameters in the backlinks, and then point GeoServer to a local copy of such document. The client should honor the links for GetMap/GetFeatureInfo and talk to the remote server, even if the caps document is local.
As a final solution, the source code for the WMS cascading is in the gt-wms GeoTools module, while the configuration UI is in GeoServer. If you or someone in your organization is proficient with Java, you can modify the code to allow injection of vendor parameters. If not, but have funds, you can contact a commercial support provider and have that functionality developed for you.
Answered by Andrea Aime on November 28, 2020
I figured it out. in the getcapabilities XML file I had to replace the '&' characters with ASCII as follows:
<GetMap>
<DCPType>
<HTTP>
<Get>
<!-- The URL here for invoking GetMap using HTTP GET is only a prefix to which a query string is appended. -->
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="https://remotewms.com/?%26CSBOOL%3D5184%26CSVALUE%3D8,,,8,,2,1"/>
</Get>
</HTTP>
</DCPType>
</GetMap>
it now works a treat.
I have discovered that Geoserver stores the getmap URL somewhere internally as it does not respond to any changes I make to the getcapabilities file. to reflect a change I need to make a new store each time
hope this helps
Answered by Paul Kennedy on November 28, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP