geotoolsmapserver

GeoTools getCapabilities with no CRS in boundingbox


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?


Solution

  • 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.