我正在尝试从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();
}
但是我收到了这个错误:
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
XML的功能就像这样(重要的部分):
正如我所看到的,边界框实际上没有CRS,但我对此无能为力,因为它不是我的服务器。
我该怎么办?
你需要提交bug report with the MapServer team。 CRS
是一个必修元素,你不能把它留空,并期望让边界框有意义。在一个理想的世界里,GeoTools可以回到Ex_GeographicBoundingBox
,但这也没有帮助。
还值得联系服务器的所有者并要求他们修复该层的配置。