1

I'm tring to retrieve a cababilities from a MapServer:

    URL url = null;
    try {
      url = new URL( sourceUrl );
    } catch (MalformedURLException e) {
      //will not happen
    }

    WebMapServer wms = null;
    try {
      wms = new WebMapServer(url);

      WMSCapabilities capabilities = wms.getCapabilities();

      String serverName = capabilities.getService().getName();
      String serverTitle = capabilities.getService().getTitle();
      System.out.println("Capabilities retrieved from server: " + serverName + " (" + serverTitle + ")");         


    } catch (Exception e) {
        e.printStackTrace();
    }   

But I'm receiving this error:

Caused by: org.xml.sax.SAXException: Bounding Box element contains no CRS/SRS attribute
    at org.geotools.ows.wms.xml.WMSComplexTypes$_BoundingBoxType.getValue(WMSComplexTypes.java:3241)
    at org.geotools.xml.handlers.ComplexElementHandler.endElement(ComplexElementHandler.java:140)
    at org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:252)
    ... 87 more

The capabilities XML is like this ( the important part ):

enter image description here

As I can see, the boundingbox is really without a CRS but I can do nothing about this since it is not my server.

How can I proceed?

Magno C
  • 1,922
  • 4
  • 28
  • 53
  • What version of mapserver is this? it will say in the top of the GetCapabilities response – user27874 Oct 22 '19 at 12:17
  • @user27874 thanks but it is not relevant anymore. Already get a workaround. – Magno C Oct 22 '19 at 14:33
  • Good that you have a workaround, but would still be nice to know which version of MapServer that has/had the problem so that can see if there's a need to file a bug, or upgrade etc. – user27874 Oct 24 '19 at 14:19
  • Ok. I'll try to find this. Not working on this anymore. – Magno C Oct 25 '19 at 01:20

1 Answers1

0

You need to file a bug report with the MapServer team. CRS is a mandatory element and you can't leave it blank and expect to make the bounding box make sense. In an ideal world GeoTools could fall back on the Ex_GeographicBoundingBox but that would be no help here either.

It is also worth contacting the owner of the server and asking them to fix the configuration of that layer.

Ian Turton
  • 10,018
  • 1
  • 28
  • 47