TerriaJS / terriajs

A library for building rich, web-based geospatial data platforms.
https://terria.io
Apache License 2.0
1.17k stars 362 forks source link

LeafletVisualizer exceptions when trying to view KML/KMZ files #1887

Open leylines opened 8 years ago

leylines commented 8 years ago

There are several problems loading kml in versions > 4.0.

Source: http://maps.leylines.ch/geo-data/climateviewer.org/Pyramids-FR-CV3D.kmz Error: LeafletVisualizer.js:660 Uncaught TypeError: Cannot read property 'color' of undefined

Source: http://www.ancientpenwith.org/files/Penwith-Ancient-Sites---Alignments-April2016.kml Error: LeafletVisualizer.js:614 Uncaught TypeError: Cannot read property 'toDataURL' of undefined

Source: http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/1.0_week_depth_link.kml Error: LeafletVisualizer.js:412 Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.

Thanks,

Jörg

leylines commented 8 years ago

Maybe some additional words about this issue:

The main problem is imho that terriajs always uses leaflet (because of the preview) with the newui when choosing a kml from the catalog, even with ViewerMode.Cesium*. The 3D-globe gets inaccessible in this case. With the oldui, terriajs just used leaflet in 2D-mode or in case of WebGL issues.

A solution to the problem could be to use cesium-2D mode as default and leaflet just in case of WebGL issues.

Cheers,

Jörg

kring commented 6 years ago

This issue is not quite as bad as originally reported. Errors on the 2D map are now handled better, so at least the KMZ-on-Leaflet problems don't prevent these files from being used in the 3D view.

The fact remains that there are bugs in LeafletVisualizer that prevent these and probably lots of other KMZ files from working properly.