When creating Style SLD with PNG Image Icon from web the rendering shows gray box

I’ve been getting a rendering issue while trying to use web images (png) as image icons, it shows a gray box instead of rendering the icon.

I’m using the GeoServer version: 2.24.4 in a docker container using the docker image: https://hub.docker.com/layers/geonode/geoserver/2.24.4-v1/images/sha256-fcd46f33236edcb93b237d1fb7eef350550b90e83976697763f1a4bf0641527e?context=explore

Here is my style SLD snippet:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
  <NamedLayer>
    <se:Name>cctv_cameras</se:Name>
    <UserStyle>
      <se:Name>cctv_cameras</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>Single symbol</se:Name>
          <se:PointSymbolizer>
            <se:Graphic>
              <se:ExternalGraphic>
                <se:OnlineResource xlink:type="simple" xlink:href="https://cdn.iconscout.com/icon/premium/png-256-thumb/webp-file-6503923-5466753.png"/>
                <se:Format>image/png</se:Format>
              </se:ExternalGraphic>
              </se:Graphic>
          </se:PointSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

After creating the SLD and publishing it with a layer, when I’m selecting it it shows the gray box as in layer preview:

Here is the image I’m using:

The relevant geoserver log entry:

24 Sep 01:22:44 WARN   [geotools.xsd] - Sax parser property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' not recognized.  Xerces version is incompatible.
24 Sep 01:22:44 WARN   [geotools.xsd] - Sax parser property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' not recognized.  Xerces version is incompatible.
24 Sep 01:22:51 WARN   [geotools.xsd] - Sax parser property 'http://www.oracle.com/xml/jaxp/properties/entityExpansionLimit' not recognized.  Xerces version is incompatible.

Any suggestions?

Hi,
it’s likely due to the URL checks blocking access to an external web site.
Starting with 2.24.0, a GeoServer can only connect to a set of approved external web sites, to avoid server side request forgery attacks.
See documentation about it here:
https://docs.geoserver.org/maintain/en/user/security/urlchecks.html

1 Like

Did you check that the server, as well as the user GeoServer is running under, have access to the internet?

Two observations:

  1. The gray rectangle is often the default placeholder suggested by the SLD specification. So chances GeoServer cannot read your icon?
  2. Recently we added URLChecks when referencing any thing that is on an external service (in your case a content delivery network).

Recommendation:

  • Can you move the icon to the geoserver styles folder please? The style editor has a choose image dialog that can be used to upload.
  • Or look at URLChecks in the manual to add your CDN to the list of locations GeoServer is allowed to talk to.

The entityExpansionLimit warning is GeoServer trying to configure the XML Parser provided by Java. Can I ask what version of Java you are using?

Thank you very much for pointing to the URL Check option. Using it or disabling url check it was able to render correctly.

Thanks a lot for the help.

The GeoServer is running in a docker container and it does not have internet access, I’ve checked. It was acting as a backend of a GeoNode server. But the issue was “URL Check” and it is resolved.

Thanks for you help.

“URL Check” was the solution. Thank you.

Note 1: I was able to render correctly by add local image in style editor.
Note 2: I was able to render correctly by disabling url check or adding regex for pattern matching.

Thanks a lot for your help.