Looking further into this specific service, apparently this WMTS
capabilities document is generated by a Lua script that just copies the
width and height values from a YAML configuration file, without making
sure the resulting capabilities valid according to the WMTS schema.
The Lua code is here:
https://github.com/nasa-gibs/onearth/blob/main/src/modules/gc_service/gc_service.lua#L514
An example YAML file with a 85.5 height for a legend is here, among
other places:
https://github.com/nasa-gibs/onearth/blob/main/docker/sample_configs/layers/epsg4326/best/GEDI_ISS_L3_Elevation_Mean_Lowest_Mode_201904-202004.yaml#L43
Maybe you can send an e-mail to supp...@earthdata.nasa.gov to ask them
to change their YAML files to use integer legend widths and heights or
create an issue in their GitHub repository.
Matthijs
On 02/12/2022 11.15, Matthijs Laan via GeoTools-GT2-Users wrote:
XML Schema says Capabilities are invalid.
<attribute name="width" type="positiveInteger">
<annotation>
<documentation>Width (in pixels) of the
legend image</documentation>
</annotation>
</attribute>
<attribute name="height" type="positiveInteger">
<annotation>
<documentation>Height (in pixels) of the
legend image</documentation>
</annotation>
</attribute>
Matthijs
On 30/11/2022 15.55, Roar Brænden wrote:
Hi,
It seems like this height=85.5 is coming from the capabilities
document. Here for instance:
<Style isDefault="true">
<ows:Title xml:lang="en">default</ows:Title>
<ows:Identifier>default</ows:Identifier>
<LegendURL width="378"
xlink:href="https://gibs.earthdata.nasa.gov/legends/AMSU_Brightness_Temp_H.svg"
xlink:role="http://earthdata.nasa.gov/gibs/legend-type/horizontal"
height="85.5" format="image/svg+xml" xlink:title="GIBS Color Map
Legend: Horizontal" xlink:type="simple"/>
<LegendURL width="135"
xlink:href="https://gibs.earthdata.nasa.gov/legends/AMSU_Brightness_Temp_V.svg"
xlink:role="http://earthdata.nasa.gov/gibs/legend-type/vertical"
height="288" format="image/svg+xml" xlink:title="GIBS Color Map
Legend: Vertical" xlink:type="simple"/>
</Style>
Haven't looked in the WMTS specification to see if that is against
the rules, but sure isn't anything the user could fix. Geotools is
tolerant elsewhere, so it could certainly be a place for a little
flexibility. Not sure how to handle it though.
Best regards,
Roar Brænden
30. nov. 2022 kl. 10:11 skrev Ian Turton <ijtur...@gmail.com>:
Height is in pixels and is an integer value so your value of 85.5 is
a problem, your code example doesn't show how you are generating the
size request but I would expect a height/width of 255 or 512 for a
WMTS request. It's possible that the GeoTools WMTS code doesn't
understand the TIME dimension or the value RESTful as an encoding,
you'll need to turn the logging level up to find out exactly why
that URL is being used.
Ian
On Wed, 30 Nov 2022 at 08:45, Daniel Kindermann <daniel.k...@gmx.de>
wrote:
Hello GeoTools community,
I'm new to GeoTools. Currently I'm trying to establish a
connection to a WMTS. I followed the instructions in the WMTS —
GeoTools 28-SNAPSHOT User Guide
<https://docs.geotools.org/stable/userguide/extension/wmts/index.html#wmtstileservice>.
Unfortunately the request to the WMTS failes.
*Here are my system information:*
GeoTools version 28-SNAPSHOT (built from
r175672287370cf2c54eb30f2bbaa04f743835523)
Java version: 17.0.4.1
Operating system: Windows 10 10.0
GeoTools jars on classpath:
I use Maven. My pom.xml is pretty much the one from the
quickstart tutorial but of course I added the gt-wmts dependency.
*Here is my error message:*
Nov. 30, 2022 9:39:18 AM
org.geotools.data.ows.AbstractOpenWebService internalIssueRequest
SCHWERWIEGEND: Failed to execute request
https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi?REQUEST=GetCapabilities&VERSION=1.0.0&SERVICE=WMTS
<https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi?REQUEST=GetCapabilities&VERSION=1.0.0&SERVICE=WMTS>
Exception in thread "main" java.lang.RuntimeException: Parsing
failed for height: java.lang.NumberFormatException: For input
string: "85.5"
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:351)
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:112)
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:415)
at
org.geotools.ows.wmts.WMTSSpecification$GetCapsRequest.createResponse(WMTSSpecification.java:387)
at
org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:461)
at
org.geotools.data.ows.AbstractOpenWebService.issueRequest(AbstractOpenWebService.java:489)
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:151)
at org.geotools.tutorial.App.main(App.java:28)
Caused by: java.lang.NumberFormatException: For input string: "85.5"
at
java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:668)
at java.base/java.math.BigInteger.<init>(BigInteger.java:536)
at java.base/java.math.BigInteger.<init>(BigInteger.java:674)
at
org.geotools.xs.bindings.XSIntegerBinding.parse(XSIntegerBinding.java:96)
at
org.geotools.xsd.impl.ParseExecutor.visit(ParseExecutor.java:142)
... 32 more
*Here is my code sample: *
public class App {
public static void main(String[] args) throws
ServiceException, IOException {
System.out.println(GeoTools.getAboutInfo());
URL url = null;
try {
url = new
URL("https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi");
} catch (MalformedURLException e) {
// will not happen
}
WebMapTileServer wmts = null;
try {
wmts = new WebMapTileServer(url);
} catch (IOException e) {
// There was an error communicating with the server
// For example, the server is down
} catch (ServiceException e) {
// The server returned a ServiceException (unusual in
this case)
} catch (SAXException e) {
// Unable to parse the response from the server
// For example, the capabilities it returned was not valid
}
System.out.println(wmts.getCapabilities().getService().getName());
}
}
I tried different servers. I get a response to a manual request
from all of them.
It would be very much appreciated if anyone has a solution or a
hint for me.
Thanks in advance,
Daniel
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
--
Ian Turton
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users