Geotools при доступе к сервису WMTS генерирует синтаксический анализ stackoverflow - PullRequest
0 голосов
/ 07 мая 2018

Я получаю доступ
http://geodata.nationaalgeoregister.nl/luchtfoto/infrarood/wmts?request=GetCapabilities&service=WMTS
(это одна из многих бесплатных услуг, доступных на голландском сайте PDOK здесь )

Я использую JMapFrame (Java 1.8u131x86, модуль Geotools 18.3, неподдерживаемый свинг). Кидает:

May 07, 2018 4:37:29 PM org.geotools.xml.resolver.SchemaCache resolveLocation
INFO: Cached XML schema: http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd
May 07, 2018 4:37:30 PM org.geotools.xml.resolver.SchemaCache resolveLocation
INFO: Cached XML schema: http://schemas.opengis.net/wmts/1.0/wmts.xsd
May 07, 2018 4:37:30 PM org.geotools.xml.resolver.SchemaCache resolveLocation
INFO: Cached XML schema: http://schemas.opengis.net/wmts/1.0/wmtsKVP.xsd
May 07, 2018 4:37:31 PM org.geotools.data.ows.AbstractOpenWebService internalIssueRequest
SEVERE: Failed to execute request http://geodata.nationaalgeoregister.nl/luchtfoto/infrarood/wmts?REQUEST=GetCapabilities&VERSION=1.3.0&SERVICE=WMS
Exception in thread "main" java.lang.StackOverflowError
    at java.io.InputStream.<init>(InputStream.java:45)
    at java.io.FileInputStream.<init>(FileInputStream.java:123)
    at java.io.FileInputStream.<init>(FileInputStream.java:93)
    at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:623)
    at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:148)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:805)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:274)
    at org.geotools.xml.SchemaFactory.getRealInstance(SchemaFactory.java:323)
    at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:309)
    at org.geotools.xml.handlers.xsi.SchemaHandler.compress(SchemaHandler.java:386)
    at org.geotools.xml.handlers.xsi.RootHandler.getSchema(RootHandler.java:118)
    at org.geotools.xml.XSISAXHandler.getSchema(XSISAXHandler.java:258)
    at org.geotools.xml.SchemaFactory.getRealInstance(SchemaFactory.java:334)
    at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:309)
    at org.geotools.xml.handlers.xsi.SchemaHandler.compress(SchemaHandler.java:386)
    at org.geotools.xml.handlers.xsi.RootHandler.getSchema(RootHandler.java:118)
    at org.geotools.xml.XSISAXHandler.getSchema(XSISAXHandler.java:258)
    at org.geotools.xml.SchemaFactory.getRealInstance(SchemaFactory.java:334)
    at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:309)
    at org.geotools.xml.handlers.xsi.SchemaHandler.compress(SchemaHandler.java:386)
    at org.geotools.xml.handlers.xsi.RootHandler.getSchema(RootHandler.java:118)
    at org.geotools.xml.XSISAXHandler.getSchema(XSISAXHandler.java:258)
    at org.geotools.xml.SchemaFactory.getRealInstance(SchemaFactory.java:334)
    at org.geotools.xml.SchemaFactory.getInstance(SchemaFactory.java:309)
    at org.geotools.xml.handlers.xsi.SchemaHandler.compress(SchemaHandler.java:386)

Похоже, что XML, возвращаемый веб-службой, отформатирован не так, как ожидалось. Что я могу с этим поделать?

1 Ответ

0 голосов
/ 14 июня 2018

Если вы используете WMSServer с URL-адресом WMTS, возможно, возникает проблема с поиском схем - я открыл ошибку .

Но простой ответ - построить его так:

URL url = new URL("http://geodata.nationaalgeoregister.nl/luchtfoto/infrarood/wmts?request=GetCapabilities&service=WMTS");
try {
  wmts = new WebMapTileServer(url);
} catch (ServiceException | IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
  System.exit(2);
}
WMTSCapabilities capabilities = wmts.getCapabilities();
List<WMTSLayer> wmtsLayers = capabilities.getLayerList();
...