• Resolved mygrove

    (@mygrove)


    I am trying to use a KML file that I have uploaded to my server. The file is in the folder at …/wp-content/uploads/KML/

    The documentation is not clear how the path to the KML should be written:

    Is it:

    [leaflet-map fitbounds scrollwheel]
    [leaflet-kml src=”wp-content/uploads/KML/mydata.kml”]

    or, something like the full path. Are quotes necessary?

    [leaflet-map fitbounds scrollwheel]
    [leaflet-kml src=https://mydomain.com/wp-content/uploads/KML/mydata.kml]

    Either way, the KML overlay file is not showing.

Viewing 7 replies - 16 through 22 (of 22 total)
  • Plugin Contributor hupe13

    (@hupe13)

    It is difficult to say what works. Every webserver is configured differently. For some, only one line is enough, others need both. And your webserver is LiteSpeed. I don’t know how to configure it. Write the two lines in your .htaccess, the first line is the same in my answers.

    If it don’t work, please ask you hosting provider.

    Each filename has an extension which gives information about the content. This must be configured in the webserver settings or .htaccess. Your webserver send it as text file, but it is a kml file. You can see this in the browser’s developer tools. kml ist a form of xml, see MIME types.

    • This reply was modified 8 months ago by hupe13.
    Thread Starter mygrove

    (@mygrove)

    OK, my hosting provider has made some tweaks to the server and the page now works on Firefox but not Chrome, Brave or Edge.

    On the three browsers that don’t work they all throw the same error in the console:

    Uncaught TypeError: Cannot read properties of null (reading 'getElementsByTagName')
    at get (togeojson.js?ver=3.4.1:15:35)
    at Object.kml (togeojson.js?ver=3.4.1:110:30)
    at request.t.onreadystatechange (leaflet-ajax-geojson.min.js?ver=3.4.1:1:561)
    Plugin Contributor hupe13

    (@hupe13)

    Unfortunately, your hosting provider did not configure it correctly. The content type is still text/plain.

    How to check the MIME type of received content

    Thread Starter mygrove

    (@mygrove)

    An update and another question.

    My hosting provider has suggested moving my site to a different server. However, before doing that I have noticed an additional point.

    My page works in Brave (a Chromium browser) on one pc on my network but not on another machine on the same network with the same browser.

    Uncaught TypeError: Cannot read properties of null (reading 'getElementsByTagName')
        at get (togeojson.js?ver=3.4.1:15:35)
        at Object.kml (togeojson.js?ver=3.4.1:110:30)
        at request.t.onreadystatechange (leaflet-ajax-geojson.min.js?ver=3.4.1:1:561)The one that does not work it throws this error in the console but the one that works, not surprisingly there are no errors at all. How can this be?

    Even more puzzling the page work in Firefox on the machine that does not work in Brave but does not work on the machine where Brave does work (i.e. they are the opposite way around.

    The Firefox error is similar:

    Uncaught TypeError: x is null
        get https://unpkg.com/@mapbox/[email protected]/togeojson.js?ver=3.4.1:15
        kml https://unpkg.com/@mapbox/[email protected]/togeojson.js?ver=3.4.1:110
        onreadystatechange https://edintone.com/wp-content/plugins/leaflet-map/scripts/leaflet-ajax-geojson.min.js?ver=3.4.1:1
    

    How can this be? How to debug it further?

    Plugin Contributor hupe13

    (@hupe13)

    The errors result from the incorrectly configured MIME type. I tested Brave, it’s the same there.

    Thread Starter mygrove

    (@mygrove)

    Unfortunately my hosting service is not willing to update the server. So I have to look elsewhere for an OSM map solution. Thanks for your help.

    Plugin Contributor hupe13

    (@hupe13)

    It’s a pity.

Viewing 7 replies - 16 through 22 (of 22 total)
  • The topic ‘KML options not working’ is closed to new replies.