2

I'm accessing
http://geodata.nationaalgeoregister.nl/luchtfoto/infrarood/wmts?request=GetCapabilities&service=WMTS
(it's one of the many free services found on the Dutch PDOK site here)

I'm using the JMapFrame (Java 1.8u131x86, Geotools 18.3 module unsupported swing). It throws:

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)

It seems that the XML returned by the web service isn't formatted as expected. Is there anything i can do about it?

Houtman
  • 2,819
  • 2
  • 24
  • 34
  • The getcapabilities looks ok at first glance, can you open a geotools bug and assign it to me. I'll take a look when I get some spare time. http://www.geotools.org/getinvolved.html – Ian Turton May 09 '18 at 10:40

1 Answers1

0

If you use a WMSServer with a WMTS url, there seems to be an issue looking up the schemas - I've opened a bug.

But the simple answer is to construct it like this:

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();
Ian Turton
  • 10,018
  • 1
  • 28
  • 47