Select to view content in your preferred language

Possible Bug with WMS Raster Layer Printing in ArcGIS Core 4.33.14

261
2
3 weeks ago
mukecz1
Occasional Contributor

Hi Esri,

I believe this may be a bug. I’m using PrintParameters from @ArcGIS/core version 4.33.14.

I can add a WMS raster layer from GeoServer, and it prints correctly if the raster contains RGB values. However, if the raster only contains a grey index with a style, the layer does not display in the printed map.

The printing function I’m using is Execute Task of ArcGIS Server.

What I found:

  1. Direct WMS URL works:
    If the WMS URL is https://xyzx:8443/geoserver/wms, it prints correctly. For example:

{
  "type": "wms",
  "customLayerParameters": null,
  "customParameters": null,
  "transparentBackground": true,
  "visibleLayers": ["LayerName"],
  "url": "https://xyzx:8443/geoserver/wms",
  "version": "1.3.0",
  "id": "19973df88a0-layer-53",
  "title": "Canopy 05 metre",
  "opacity": 1,
  "minScale": 0,
  "maxScale": 0
}
  1. Using PrintParameters automatically:

const params = new PrintParameters({
  view: view.value,
  template: template,
  outSpatialReference: spatialReference
} as PrintParametersProperties);

It automatically uses the layers on the MapView. For the WMS raster layer, the URL it passes becomes:
https://xyz:8443/geoserver/ows?version=1.3.0

This URL does not work, and the grey-index raster layer with a style is not displayed in the printed map.

Could you advise if this is expected behavior or a bug?

Thanks

Tags (3)
0 Kudos
2 Replies
Noah-Sager
Esri Regular Contributor

Hi @mukecz1, thanks for posting your question here. It sounds like there is an issue with the URL passed to the print service. Here are the facts as I understood them:

WMS raster layer from GeoServer.

Prints correctly if the raster contains RGB values.

Does not print if the raster only contains a grey index with a style.

I have a hunch about what's going on, but it would be super helpful if you could share a test-app or test services so I could reproduce on my end and compare?

0 Kudos
mukecz1
Occasional Contributor

Hi @Noah-Sager ,

Unfortunately, I cannot share either the app or the service. The workaround for me is to use this code before passing it to

PrintParameters

. As you can see, I only replaced the URL endpoint from /ows?version=1.3.0 to /wms:

mapView.map.allLayers.forEach((layer: any) => {
if (layer && layer.visible && layer.type === 'wms' && layer.url && layer.url.includes('/ows?version=')) {
// Store original URL for restoration
wmsLayersToRestore.push({ layer, originalUrl: layer.url });
// Temporarily correct the URL
layer.url = layer.url.replace(/\/ows\?version=[\d.]+/g, '/wms');
}
});

And restore them after printing by using:

wmsLayersToRestore.forEach(({ layer, originalUrl }) => {
layer.url = originalUrl;
});
0 Kudos