• Resolved martinsplinter

    (@martinsplinter)


    So since my url for the gpx was messed up i have uploaded the file to my server directly.
    When i now change the url to /plan.gpx it get a status 200 and with application in the header.

    However i get tnhis errer:
    construct-leaflet-map.min.js?ver=3.0.4:1 TypeError: Cannot read properties of undefined (reading ‘addLayer’)
    at i.addTo (Layer.js:52:7)
    at Object.getGroup (construct-leaflet-map.min.js?ver=3.0.4:1:1215)
    at Object.newMarkerGroup (construct-leaflet-map.min.js?ver=3.0.4:1:1268)
    at Object.getCurrentGroup (construct-leaflet-map.min.js?ver=3.0.4:1:1060)
    at WPLeafletkmlShortcode ((index):232:39)
    at t (construct-leaflet-map.min.js?ver=3.0.4:1:107)
    at init (construct-leaflet-map.min.js?ver=3.0.4:1:355)

    I have no clue to what that means, but some googling seems to suggest that the add layer thingie is to soon, before the DCOM (whatever that means) is loaded.

    The suggestion was to move the script to the end of the body of the page, probably to make sure all else is loaded first.

    B ut how do i do that if its true?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter martinsplinter

    (@martinsplinter)

    after some fidling:

    togeojson.js?ver=3.0.4:15 Uncaught TypeError: Cannot read properties of null (reading ‘getElementsByTagName’)
    at get (togeojson.js?ver=3.0.4:15:35)
    at Object.kml (togeojson.js?ver=3.0.4:110:30)
    at request.t.onreadystatechange (leaflet-ajax-geojson.min.js?ver=3.0.4:1:561)
    get @ togeojson.js?ver=3.0.4:15
    kml @ togeojson.js?ver=3.0.4:110
    request.t.onreadystatechange @ leaflet-ajax-geojson.min.js?ver=3.0.4:1
    XMLHttpRequest.send (asynchroon)
    (anoniem) @ VM324:1
    onAdd @ leaflet-ajax-geojson.min.js?ver=3.0.4:1
    _layerAdd @ Layer.js:114
    whenReady @ Map.js:1465
    addLayer @ Layer.js:176
    addLayer @ LayerGroup.js:47
    addLayer @ FeatureGroup.js:35
    addTo @ Layer.js:52
    WPLeafletkmlShortcode @ (index):252
    t @ construct-leaflet-map.min.js?ver=3.0.4:1
    init @ construct-leaflet-map.min.js?ver=3.0.4:1
    load (asynchroon)
    (anoniem) @ construct-leaflet-map.min.js?ver=3.0.4:1
    (anoniem) @ construct-leaflet-map.min.js?ver=3.0.4:1

    Plugin Contributor hupe13

    (@hupe13)

    Do you have an url to a test page?

    Thread Starter martinsplinter

    (@martinsplinter)

    Plugin Contributor hupe13

    (@hupe13)

    The content-type is “application/octet-stream”.
    https://www.ads-software.com/support/topic/ampersand-3/#post-15992509

    So you need to write in your .htaccess:

    AddType application/gpx+xml gpx
    RewriteRule .*\.gpx$ - [L,T=application/gpx+xml]
    Thread Starter martinsplinter

    (@martinsplinter)

    I added it when u told me so in the other thread. the response i get:

    URL aanvragen: https://shipdocs.app/plan.gpx
    Verzoekmethode: GET
    Statuscode: 200
    Extern adres: 172.67.161.79:443
    Verwijzersbeleid: strict-origin-when-cross-origin
    accept-ranges: bytes
    alt-svc: h3=”:443″; ma=86400, h3-29=”:443″; ma=86400
    cf-cache-status: DYNAMIC
    cf-ray: 74802b34edf1069a-LHR
    content-length: 1403
    content-type: application/octet-stream

    What should i see instead of content-type: application/octet-strea os is that correct?

    RewriteEngine On
    AddType application/gpx+xml gpx
    RewriteRule .*\.gpx$ – [L,T=application/gpx+xml]
    # END WordPress

    Thread Starter martinsplinter

    (@martinsplinter)

    mmm would it be different for litespeed?

    Plugin Contributor hupe13

    (@hupe13)

    RewriteEngine On
    AddType application/gpx+xml gpx
    RewriteRule .*\.gpx$ – [L,T=application/gpx+xml]
    # END WordPress

    Insert the two line BEFORE #BEGIN WordPress

    AddType application/gpx+xml gpx
    RewriteRule .*\.gpx$ – [L,T=application/gpx+xml]
    
    #BEGIN WordPress
    Thread Starter martinsplinter

    (@martinsplinter)

    i added it first where u told me, but no result.
    Then in tghe beginnen of the file, but also no luck.

    I think litespeed needs smth else, i will look into it.

    I saw one other plugin that allowed me to upload a gpx file from its interface, that did work. Also the example file works.

    Thread Starter martinsplinter

    (@martinsplinter)

    so i changed to apache for this problem, used the defaults:

    AddType application/gpx+xml gpx
    RewriteRule .*\.gpx$ – [L,T=application/gpx+xml]

    # BEGIN WordPress

    RewriteEngine On
    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    No luck

    Plugin Contributor hupe13

    (@hupe13)

    Please check the shortcode on your test page above. You have a typo in it.
    The content-type of the gpx file is okay, I checked this.

    Thread Starter martinsplinter

    (@martinsplinter)

    Its working!!!!!

    Adding the code to the htaccess did not do it, bnut adding it as a handler to apache did the trick!

    Thanks for your patience

    Thread Starter martinsplinter

    (@martinsplinter)

    Oh we cross posted, wsell i am just happy it works now.
    Ill try it without the apache handlers later just to see.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘can not read properties’ is closed to new replies.