Announcement

Collapse
No announcement yet.

XML parsing error

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML parsing error

    Hello

    I've encountered an error that I'm unable to get past at this time. I was wondering if anyone here might have a possible solution. I downloaded the android worldwind code from github and compiled and ran it using android studio on one of the emulators. So far I haven't had any problems running any of the tutorials or examples.

    I'm trying to slightly modify the WMTS example to use a different WMTS server than the one that's hardcoded into the example. Currently the example uses:
    https://tiles.geoservice.dlr.de/service/wmts and "hillshade" as the identifying layer.

    I'm trying to use:
    http://gis.sinica.edu.tw/worldmap/wmts and "BingA" as the identifying layer.

    The only change I made to the code was replace the hardcoded string on line 32 of the WmtsLayerFragment.java file with from using the previous server to the sinica.edu server, and the hardcoded layer string on line 33 from hillshade to BingA, but when I try to run the code with those changes I get:

    E/gov.nasa.worldwind: WMTS layer creation failed
    java.lang.RuntimeException: LayerFactory.retrieveWmsCapabilities: Unable to open connection and read from service address java.lang.ClassCastException: gov.nasa.worldwind.util.xml.DefaultXmlMo del cannot be cast to java.lang.String
    at gov.nasa.worldwind.layer.LayerFactory.re trieveWmtsCapabilities(LayerFactory.java :490)
    at gov.nasa.worldwind.layer.LayerFactory.cr eateFromWmtsAsync(LayerFactory.java:323)
    at gov.nasa.worldwind.layer.LayerFactory$Wm tsAsyncTask.run(LayerFactory.java:932)

    Stepping through the code doesn't really help me figure out why it's trying to cast an xml DefaultXmlModel to a String. There is a for loop in XmlModelParser.java that seems to parse through the entire xml file from the WMTS server without any problems, but when it's finishing it throws that exception. I can't tell what is causing that.

    Can you help me with this? or provide an example of what a well formatted WMTS xml needs to be in order for this parser to work?

    As a side note, I tried using both of these servers on QGIS and they both work if I point them to the URLs that I mentioned above, no parsing issues.

    Thanks


  • #2
    Thanks for bringing this to our attention. There seems to be two problems.

    The first one, resulting in your stack trace looks like the ows:BoundingBox LowerCorner and UpperCorner elements in the TileMatrixSet definition do not have the proper the XML namespace. Look at line 721 and 722 to a get capabilities request: http://gis.sinica.edu.tw/worldmap/wm...etCapabilities I believe they should have the "ows:" namespace prefix. At least that is where our parser is getting confused. You can register the erroneous LowerCorner and UpperCorner elements to the parser as a work around. There is a function available on WmtsXmlParser which accepts the element name and namespace. You would want to register these elements using the "registerTxtModel" method. I'm assuming QGIS isn't strictly checking the namespace for these two elements and that is why they work.

    The second issue, is the BingA layer you want to visualize only uses a TileMatrixSet in a Web Mercator projection (EPSG:3857). WorldWindAndroid doesn't have support for EPSG:3857 so it wouldn't be able to use that resource anyway.

    If possible, I would recommend looking into some of the layers provided by EOX. They have a number of imagery and OSM layers available in WMS and WMTS and most of it is compatible with WorldWindAndroid. You can learn more about EOX here: https://s2maps.eu/

    If you find reason to believe our parsing model is incorrect in how it is handling the documents namespace, please open an issue on GitHub: https://github.com/NASAWorldWind/WorldWindAndroid

    Thanks!
    Zach
    World Wind Team
    https://github.com/NASAWorldWind

    Comment


    • #3
      Hello Zach

      Thank you for the prompt response and the clarification on support for EPSG:3857. I will look into using the layers provided by EOX.
      Appreciate the help!

      v/r

      Ty

      Comment

      Working...
      X