Search code examples
javascriptjavagoogle-mapskmlgoogle-earth

Unable to render kml file in google earth


I am getting big transparent white box with a red border and red X as output when I try to render below kml file in Google Earth. Could anyone please let me know why it is not rendering properly.

kml file link : https://www.wpc.ncep.noaa.gov/kml/winwx/HPC_Day1-3_psnow_gt_08_nlbody.kml


Solution

  • If you're trying to view this in the new Google Earth (v9) on web, then you're likely hitting CORS issues.

    The link provided the comments is working for me when viewed in Earth Pro (v7), where it loads a screen overlay with a legend, a few small data polygons in the Rocky Mountains, and a giant ground-overlay image with white text on it over the middle of the USA.

    On Google Earth for web, it gives me the red X that you're describing. If you look at the Chrome developer console, you'll see that the images requested by that KML file come from a server that does not have the necessary CORS (Cross Origin Request) headers set on the outgoing files (screenshot below). The red X is just what Earth shows when it can't get or load an image. Unfortunately Earth on web has additional security requirements, and all files requested by the app must have CORS enabled. Unless you know someone at NOAA who can update the server to provide the necessary CORS headers, you'll have to stick with Earth Pro to view this one.

    Screenshot of your KML loaded in Earth for web, with CORS errors in console