• Resolved thefallguy

    (@thefallguy)


    I have leaflet map installed on my WP site. I am displaying maps and markers with no problems. However, I am now trying to add a leaflet-gpx (shortcodes below), but all I am getting is a map in my default location. I have uploaded the gpx file to Amazon S3 and made it publicly available. (Note the GPX file is a copy of the one provided in the shortcuts helper)

    Any ideas on why this is not working?

    [leaflet-map height=500 fitbounds zoomcontrol scrollwheel]

    [leaflet-gpx src=”https://camrollers-gpx.s3-eu-west-1.amazonaws.com/run.gpx” color=red]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author bozdoz

    (@bozdoz)

    First guess is that it is not accessible over cross-domain. Maybe check your developer console to see if there are any errors. Alternatively, perhaps the content-type is incorrect (perhaps AWS is not sending the file as a GPX). Again, you might be able to find out what the issue is from the developer tools.

    Thread Starter thefallguy

    (@thefallguy)

    Thanks for the reply. Let me tell you a few other things that I have tried:

    1. The example provided in the shortcut help. This works as expected (and is also cross-domain, so that is not the issue)

    2. Hosting the file locally (my preferred option). This does not work in exactly the same as I report in my original post

    3. The file hosted on S3 is being served correctly. Just entering the URL displays the GPX file in my browser

    Any other ideas?

    Plugin Author bozdoz

    (@bozdoz)

    No other ideas without seeing logs from a developer console or network tab. Also, on your first point, the URL in the shortcode helper has CORS enabled; that said, I’m not sure why S3 would not also be CORS enabled.

    Thread Starter thefallguy

    (@thefallguy)

    OK, I found the problem. I needed to add
    Access-Control-Allow-Origin: *
    to my site headers. Thanks for the hint.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Trying to add a leaflet-gpx’ is closed to new replies.