Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help #40

Open
hkamori opened this issue Sep 12, 2022 · 1 comment
Open

help #40

hkamori opened this issue Sep 12, 2022 · 1 comment

Comments

@hkamori
Copy link

hkamori commented Sep 12, 2022

Uncaught TypeError TypeError: Failed to fetch
at (c:\Users*\Desktop*\index.html:17:13)
--- Promise.then ---
at (c:\Users*
\Desktop*\kml\index.html:19:18)
@ c:\Users*
\Desktop*
*\kml\index.html:17:13

here is my code


        // Load kml file
        fetch('https://github.com/fullfocusbtw1/123123123.git')
            .then(res => res.text())
            .then(kmltext => {
                // Create new kml overlay
                const parser = new DOMParser();
                const kml = parser.parseFromString(kmltext, 'text/xml');
                const track = new L.KML(kml);
                map.addLayer(track);

                // Adjust map to show the kml
                const bounds = track.getBounds();
                map.fitBounds(bounds);
            });
    </script>
</body>
@KristjanESPERANTO
Copy link

You are trying to fetch a html file not a kml file. Try this: fetch('https://raw.githubusercontent.com/fullfocusbtw1/123123123/main/UspihMapUa%20(1).kml')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants