• Resolved akoelsch

    (@akoelsch)


    Hi,
    I tried to load my gpx track, but it doesn’t work. The sample gpx track from the shortcode documentation works though.

    [leaflet-map fitbounds]
    [leaflet-gpx src="wp-content/uploads/2021/09/track.gpx" color=black]

    According to DevTools, the file is retrieved by leaflet-ajax-geojson.min.js?ver=3.0.2 but there’s an uncaught error in the console.

    Uncaught TypeError: Cannot read property 'getElementsByTagName' of null
        at get (togeojson.js?ver=3.0.2:15)
        at Object.gpx (togeojson.js?ver=3.0.2:302)
        at XMLHttpRequest.request.t.onreadystatechange (leaflet-ajax-geojson.min.js?ver=3.0.2:1)

    I’m not sure what is the problem here. The file works perfectly fine in other apps.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Contributor hupe13

    (@hupe13)

    Do you have any other plugin(s) with leaflet functions activated?

    P.S. I see, that you are searching an elevation profile. Try this plugin. πŸ˜‰

    • This reply was modified 2 years, 7 months ago by hupe13.
    Thread Starter akoelsch

    (@akoelsch)

    No, I have no other plugins with leaflet functions installed. I tried your plugin, but it broke the entire page and just showed an error string instead of the page, so I had to deactivate it.

    Plugin Contributor hupe13

    (@hupe13)

    Do you have a link to your webpage? Or can I get the gpx-file?

    Thread Starter akoelsch

    (@akoelsch)

    I just tried it again and it works with your plugin now! I guess there’s some problem with the gpx->geojson conversion in the original plugin. You can use any gpx file that is generated from outdooractive to reproduce the error above.

    • This reply was modified 2 years, 7 months ago by akoelsch.
    Plugin Contributor hupe13

    (@hupe13)

    You can use any gpx file that is generated from outdooractive to reproduce the error above.

    Can’t reproduce. My test file works. Are you using the original configuration for the KML/GPX JavaScript Converter in Leaflet Map (from unpkg) or your own file?

    Thread Starter akoelsch

    (@akoelsch)

    Yes, all settings are default. togeojson.js is loaded from unpkg according to the console. Take for example the GPX file from here: https://www.outdooractive.com/de/route/bergtour/wetterstein-gebirge-und-mieminger-kette/uebergang-von-der-knorrhuette-ueber-das-gatterl-hinunter-zur-ehrwalder-alm/20135523/

    With OSM and your extension plugin deactivated and the code written above, I get the TypeError from the first post.

    Plugin Contributor hupe13

    (@hupe13)

    I tried it downloaded with and without waypoints – no problem.

    [leaflet-map fitbounds]
    [leaflet-gpx src="https://mydomain.tld/path/t20135523_uebergang von der.gpx"]

    Maybe any other plugin causes the problem.

    Thread Starter akoelsch

    (@akoelsch)

    Are you using https://unpkg.com/@mapbox/togeojson@0.16.0/togeojson.js for your tests, too?

    I realize that it works with https://unpkg.com/@tmcw/togeojson@4.3.0/dist/togeojson.umd.js instead, so I assume a bug in the first one.

    Thread Starter akoelsch

    (@akoelsch)

    I just found out, it’s not related to the gpx file. Even if I upload the run.gpx from the example, it does not work. So, I guess unpkg has a problem getting the file from my server?

    • This reply was modified 2 years, 7 months ago by akoelsch.
    Plugin Contributor hupe13

    (@hupe13)

    Other reason may be a caching plugin. If the browser can’t load any file unsuccessfully, you can see it in the Developer Console – Network tab.

    Thread Starter akoelsch

    (@akoelsch)

    leaflet-ajax-geojson.min.js?ver=3.0.2 does load my GPX file perfectly fine with status 200. The problem is that somewhere something becomes null.

    togeojson.js?ver=3.0.2:15 Uncaught TypeError: Cannot read property 'getElementsByTagName' of null
        at get (togeojson.js?ver=3.0.2:15)
        at Object.gpx (togeojson.js?ver=3.0.2:302)
        at XMLHttpRequest.request.t.onreadystatechange (leaflet-ajax-geojson.min.js?ver=3.0.2:formatted:19)
    Plugin Author bozdoz

    (@bozdoz)

    Got a link I can see?

    Thread Starter akoelsch

    (@akoelsch)

    Plugin Contributor hupe13

    (@hupe13)

    I do not know, what is possible on WordPress installations on wp.com.
    Please delete unnecessary plugins. Jetpack does not comply with the german DSGVO.

    Thread Starter akoelsch

    (@akoelsch)

    It’s not a wp.com installation. Thanks for the not regarding the dsgvo. It’s really hard to find out what is allowed and what not… It took me days to only partially understand all this cookie stuff. And I’m still not sure if I did it correctly

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Cannot load GPX file’ is closed to new replies.