I am work on a project where I need to load kml files from the client computer. They select the file and its read into a buffer on the browser. The documentation said I could load the kml into the scene directly from a raw kml string, but when I try to do it, it errors saying
"Cesium.js:1 Uncaught TypeError: Cannot read property '1' of null
at new URI (Cesium.js:1)
at new Resource (Cesium.js:1)
at Function.Resource.createIfNeeded (Cesium.js:1)
at load$2 (Cesium.js:1)
at KmlDataSource.load (Cesium.js:1)
at Function.KmlDataSource.load (Cesium.js:1)
at AppState.addKMLFromText (app.js:95)
at addKMLToScene (object-loader.js:47)
at parseClientLoadedObject (object-loader.js:32)
at FileReader.reader.onload (client-files.js:27)
The KML file loads correctly when its loaded from the server using a url. I have also verified that the file text has been loaded correctly.
addKMLFromText(fileText) {
var kmlOptions = {
camera : appState.getViewer().scene.camera,
canvas : appState.getViewer().scene.canvas,
clampToGround : true
};
appState.viewer.dataSources.add(Cesium.KmlDataSource.load(fileText, kmlOptions));
}
I would appreciate any and all help with this issue.