question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't fetch external style from KML

See original GitHub issue

Describe the bug Unable to fetch external KML style from <styleUrl>. It may detect a wrong baseUri, can’t fetch style and then display default style.

To Reproduce Steps to reproduce the behavior:

  1. Read a KML file that contains external style (exemple with <styleUrl>http://www.gdacs.org/styles/kmlstyle.kml#TC_Line</styleUrl>)
  2. Try again with a kml viewer like http://kmlviewer.nsspot.net/
  3. See error

Bug : Capture d’écran 2021-06-23 à 11 15 59

Expected behavior Expected style : Capture d’écran 2021-06-23 à 10 48 45

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
hlehmanncommented, Jun 24, 2021

Thanks for your quick answers, so there is two issues here :

  1. readFeatures() is synchronous for now, so it can’t load styles from external sources. The solution I see is to first check every external sourceUrl and load them before to execute readFeatures().
  2. gdacs is not respecting CORS protocol causing issues with images but that’s not linked to openlayers, {crossOrigin: null} could be a solution.
1reaction
mike-000commented, Jun 24, 2021

You could use new KML({crossOrigin: null}) to allow cross origin icons without CORS if you can tolerate imprecise hit detection and tainted canvas.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does physicalWidth not work in external style for Google ...
The KML file that contains the placemark and the KML file that contains the external style are in the same directory. I know...
Read more >
Can't Connect External Stylesheet to HTML - Stack Overflow
In my HTML sheet, I've already linked to the external CSS stylesheet as well. The HTML code is below. <style> <link rel="stylesheet" ...
Read more >
KML Reference | Keyhole Markup Language
This section contains an alphabetical reference for all KML elements defined in KML Version 2.2, as well as elements in the Google extension...
Read more >
KML layers—ArcGIS Pro | Documentation
KML layer structure ... The elements of a KML file are structured hierarchically, where each part of the hierarchy is called a node....
Read more >
Unable to fetch a KML file - Google Groups
that didn't do anything but return the 'Bad or null KML.' error that is built into the fetch KML code given in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found