mracko / MSFS-Mobile-Companion-App

Mobile Companion App for MSFS 2020
GNU Affero General Public License v3.0
355 stars 42 forks source link

Error loading KML files #65

Open bluebetto opened 2 years ago

bluebetto commented 2 years ago
L.KML.js:373 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getElementsByTagName')
    at Function.parseGroundOverlay (L.KML.js:373)
    at Function.parseFolder (L.KML.js:186)
    at Function.parseKML (L.KML.js:42)
    at i.addKML (L.KML.js:18)
    at initialize (L.KML.js:13)
    at new i (Class.js:22)
    at loadKMLOverlaysFromServer ((index):1534)

but my KML file does have the LatLonBox tag, with the south tag inside

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:ns2="http://www.google.com/kml/ext/2.2" xmlns:ns3="http://www.w3.org/2005/Atom" xmlns:ns4="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
    <Document>
        <LookAt>
            <longitude>-45.98208068336555</longitude>
            <latitude>-23.430759554078733</latitude>
            <altitude>610982.307818415</altitude>
            <heading>0.0</heading>
            <tilt>0.0</tilt>
            <range>493705.7517598564</range>
            <altitudeMode>clampToGround</altitudeMode>
        </LookAt>
        <Folder>
            <name>ICA:REA_SAO_PAULO_E_VALE_DO_PARAIBA</name>
            <LookAt>
                <longitude>-45.98208068336555</longitude>
                <latitude>-23.430759554078733</latitude>
                <altitude>610982.307818415</altitude>
                <heading>0.0</heading>
                <tilt>0.0</tilt>
                <range>493705.7517598564</range>
                <altitudeMode>clampToGround</altitudeMode>
            </LookAt>
            <GroundOverlay>
                <name>ICA:REA_SAO_PAULO_E_VALE_DO_PARAIBA</name>
                <drawOrder>10</drawOrder>
                <Icon>
                    <href>https://geoaisweb.decea.mil.br/geoserver/ICA/wms?service=wms&request=GetMap&version=1.1.1&format=image%2Fpng&layers=ICA%3AREA_SAO_PAULO_E_VALE_DO_PARAIBA&styles=raster&height=479&width=768&transparent=true&bbox=-48.001247531%2C-24.668180118%2C-44.000740942%2C-22.167863501&srs=EPSG%3A4326</href>
                    <refreshInterval>0.0</refreshInterval>
                    <viewRefreshMode>never</viewRefreshMode>
                    <viewRefreshTime>0.0</viewRefreshTime>
                    <viewBoundScale>0.75</viewBoundScale>
                </Icon>
                <altitude>0.0</altitude>
                <LatLonBox>
                    <north>-22.167863501</north>
                    <south>-24.668180118</south>
                    <east>-44.000740942</east>
                    <west>-48.001247531</west>
                    <rotation>0.0</rotation>
                </LatLonBox>
            </GroundOverlay>
        </Folder>
    </Document>
</kml>

I don`t know. Its totally random. Sometime it works. Sometimes it gives this error. Even if the KML is fine

luka97 commented 2 years ago

Hi, sorry for the late reply. The KML file you posted is invalid because you didn't escape the & character in your URL. If you change & with &amp; the KML will load correctly. If this fixes your error please close the issue.