CesiumGS / CesiumGS/cesium

KML/KMZ loading breaks for `svg+xml` images

Open
#8,071 4 comments 0 reactions 0 assignees View on GitHub
category - kml type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Sandcastle example: working on it

Browser: All?

Operating System: All?

I managed to make an entity collection that, when exported with `exportKml`, doesn't load back into Cesium correctly. I'm working on a boiled down repro / Sandcastle of this, but the short version is that each entity has a Billboard whose image is data URL containing `svg+xml`. The exported KMZ includes one SVG file for each entity, with a `.svg+xml` extension. I believe the resulting KMZ would load fine in Google Earth, but I don't have it handy for testing.

The issue is, it fails to render correctly when loaded in a KmlDataSource, because the billboards are created with an image whose value is `data:application/octet-stream;base64...`, where the base64 encoded data is the entire SVG file as a literal. As an experiment, I changed the `billboard.image._value.url` property in the console so that it uses `data:image/svg+xml;base64,...` instead, and immediately the correct image showed up on the map.

TL;DR: it sounds like KmlDataSource can't render placemarks with a `.svg+xml` filetype, even though `exportKml` will produce them. (The fact that it's loading from a KMZ instead of KML might be important, because you lose the benefit of server-specified MIME types for the image.)

Contributor guide

Open the contributing guide

Research direction

Start with KmlDataSource's KMZ image handling and compare it with the exportKml output described in the issue. Reproduce the case in a Sandcastle example using an entity Billboard with a data URL containing svg+xml; the work is done when the exported KMZ reloads in KmlDataSource and renders its SVG billboards correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.