I'm learning to use geotools librairy for load tile with WMTS protocol. I have trying with many differente version 32.1, 31.5, 31.0 in a simple envirronement excatly define like geotools documentation explained in the url in documentation purposed to use Nasa WMTS server for test. The XML capabilities return a LegendURL value that contains a width value definie at 178.0. This parameter caused a NumberFormatExecption on geotools parser.
Is it a configuration problem on Geotools or a non standart return of Nasa WMTS server ? Documentation seems to be obsolete ? Some can help me ?
I have follow the documentation at this url :
https://docs.geotools.org/latest/userguide/extension/wmts/index.html
Trying to connect to WMTS server with the documentation url :
https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi
The exception :
[2025-01-15 11:42:44] [INFOS ] java.lang.RuntimeException: Parsing failed for width: java.lang.NumberFormatException: For input string: "378.0"
at org.geotools.xsd.impl.ParseExecutor.visit(ParseExecutor.java:153)
at org.geotools.xsd.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:218)
at org.geotools.xsd.impl.BindingWalker.walk(BindingWalker.java:184)
at org.geotools.xsd.impl.BindingWalker.walk(BindingWalker.java:188)
at org.geotools.xsd.impl.ElementHandlerImpl.startElement(ElementHandlerImpl.java:180)
at org.geotools.xsd.impl.ParserHandler.startElement(ParserHandler.java:378)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:353)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:114)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326)
at org.geotools.xsd.Parser.parse(Parser.java:183)
at org.geotools.xsd.Parser.parse(Parser.java:125)
at org.geotools.ows.wmts.response.WMTSGetCapabilitiesResponse.<init>(WMTSGetCapabilitiesResponse.java:84)
at org.geotools.ows.wmts.WMTSSpecification$GetCapsRequest.createResponse(WMTSSpecification.java:381)
at org.geotools.ows.wmts.WMTSSpecification$GetCapsRequest.createResponse(WMTSSpecification.java:353)
at org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:465)
at org.geotools.data.ows.AbstractOpenWebService.issueRequest(AbstractOpenWebService.java:493)
at org.geotools.data.ows.AbstractOpenWebService.negotiateVersion(AbstractOpenWebService.java:287)
at org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:124)
at org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:97)
at org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:88)
at org.geotools.data.ows.AbstractOpenWebService.<init>(AbstractOpenWebService.java:77)
at org.geotools.ows.wmts.WebMapTileServer.<init>(WebMapTileServer.java:150)
at fr.projetlineaire.phasemanager.maps.WMTSTest$WMTSHelper.<init>(WMTSTest.java:65)
at fr.projetlineaire.phasemanager.maps.WMTSTest$WMTSHelper.of(WMTSTest.java:128)
at fr.projetlineaire.phasemanager.maps.WMTSTest.launch(WMTSTest.java:28)
at fr.projetlineaire.phasemanager.main.MainApp.start(MainApp.java:103)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:839)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:185)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.NumberFormatException: For input string: "378.0"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:662)
at java.base/java.math.BigInteger.<init>(BigInteger.java:541)
at java.base/java.math.BigInteger.<init>(BigInteger.java:679)
at org.geotools.xs.bindings.XSIntegerBinding.parse(XSIntegerBinding.java:96)
at org.geotools.xsd.impl.ParseExecutor.visit(ParseExecutor.java:142)
... 44 more
That is width
which the specification says is a positive integer number of pixels, so GeoTools rightly complains that 178.0
is not an integer. While in principal we could modify the code to accept floating point pixel values it would require modifying the XML schema and regenerating the bindings which is a lot of work to accommodate incorrect servers.