Closed rezn8d closed 6 years ago
Hi @rezn8d, I just loaded RT.atlantic.g8irn.tiles-8.kml
(the first link you sent) in Cesium 1.45 in Firefox and Chrome and I could not reproduce the error you're seeing. Did you try clearing your cache/cookies? Sometimes that can cause weird problems when switching between versions of Cesium. Also, make sure all of your graphics drivers are up to date.
If you're still seeing the problem after trying that, can you paste a code sample for how you're adding the kml to your application? Thanks
I have cleared my caches, both in Chrome and Firefox and using In Private and using CCleaner. Same crashes. My drivers are latest.
function loadKml(layerId, geoDataSrc, proxy, zoom, markerImg, markerScale, markerLabel, markerMod, noList, timeline, rectangle, noClamp) {
if (proxy) {
var resource = new Cesium.Resource({
url: geoDataSrc,
proxy: {
getURL: function (geoDataSrc) {
return proxyURL + encodeURIComponent(geoDataSrc);
}
}
});
new Cesium.KmlDataSource.load(resource, {
//sourceUri: geoDataSrc,
camera: viewer.scene.camera,
canvas: viewer.scene.canvas,
clampToGround: noClamp
}).then(function (geoData) {
console.log('loaded proxied kml');
if (markerMod) {
modKML(layerId, geoData, markerLabel, markerScale, noList, proxy);
console.log('modified proxied kml');
}
//console.log(geoData.entities);
viewer.dataSources.add(geoData); // add to map
activeLayers[layerId] = geoData; // store for removal
if (zoom === true) {
viewer.flyTo(geoData);
}
loaded(layerId, timeline, rectangle);
}, function (error) {
loadError(layerId, geoDataSrc, error);
}); // end then
} else {
new Cesium.KmlDataSource.load(geoDataSrc, {
camera: viewer.scene.camera,
canvas: viewer.scene.canvas,
clampToGround: noClamp
}).then(function (geoData) {
console.log('loaded kml');
if (markerMod) {
modKML(layerId, geoData, markerLabel, markerScale, noList);
console.log('modified kml, no proxy');
} // end markerMod
viewer.dataSources.add(geoData);
activeLayers[layerId] = geoData;
if (zoom === true) {
viewer.flyTo(geoData);
}
loaded(layerId, timeline, rectangle);
}, function (error) {
loadError(layerId, geoDataSrc, error);
}); // end then
} // end proxy
}
modKML is not used but looks like this:
function modKML(layerId, geoData, markerLabel, markerScale, noList, proxy) {
//console.log(noList);
var entities = geoData.entities.values,
items, markerList;
console.log('nolist - ' + noList);
if (noList === false) {
var layerTarget = $('.' + layerId + '-details');
markerList = $('<div class="details ' + layerId + '-list marker-list" />').insertAfter(layerTarget);
items = [];
}
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
//console.log(entity);
if (typeof entity.billboard !== 'undefined' && typeof entity.billboard.image !== 'undefined') {
if (typeof entity.name != 'undefined') {
name = entity.name;
} else {
name = 'unnamed location';
}
if (markerLabel == 'none') {
var label = new Cesium.LabelGraphics();
label.text = "";
entity.label = label;
console.log('removed kml label');
}
if (markerScale) {
entity.billboard.scale = markerScale;
}
entity.billboard.width = 32;
entity.billboard.height = 32;
//entity.label.text = '';
entity.billboard.alignedAxis = Cesium.Cartesian3.ZERO;
entity.billboard.scaleByDistance = defaultScaleByDistance;
if (noList === false) {
var v = entity.position.getValue();
var carto = Cesium.Ellipsoid.WGS84.cartesianToCartographic(v);
var lon = Cesium.Math.toDegrees(carto.longitude);
var lat = Cesium.Math.toDegrees(carto.latitude);
//console.log(lon, lat);
var name,
bcolor,
rgba,
hex;
if (typeof entity.billboard.color != 'undefined') {
console.log('marker has color');
var t = entity.billboard.color.getValue();
var blkstr = [];
$.each(t, function(idx2,val2) {
if (idx2 === 'red' || idx2 === 'green' || idx2 === 'blue') {
//var str = idx2 + ":" + val2;
blkstr.push(val2 * 255);
}
});
rgba = blkstr.join(", ");
hex = rgb2hex('rgba(' + rgba + ',1)');
} else {
hex = 'none';
}
//console.log(hex);
//hex = 'none';
var icu = entity.billboard.image.getValue()._url;
//console.log(icu);
items.push('<li data-lon="' + lon + '" data-lat="' + lat + '"><canvas width="20" height="20" class="marker-icon" data-src="' + icu + '" data-tint="' + hex + '"></canvas> ' + name + '</li>');
}
}
} // end for loop
//console.log('loop kml complete');
if (noList === false) {
$('<h5><i class="fa fa-fw fa-map-marker"></i> Map Markers <span>Click to fly to location</span></h5>').appendTo(markerList);
$('<ol/>', {
'class': 'markers',
html: items.join('')
}).appendTo(markerList);
$('.' + layerId + '-list li').click(function () {
var lon = $(this).attr('data-lon');
var lat = $(this).attr('data-lat');
viewer.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(lon, lat, 1500.0)
});
});
$('.' + layerId + '-list li canvas.marker-icon').each(function () {
var hexColor = $(this).attr('data-tint');
var icUrl = $(this).attr('data-src');
var tintCanvas = document.createElement('canvas');
tintCanvas.width = 20;
tintCanvas.height = 20;
var tintCtx = tintCanvas.getContext('2d');
var ctx = $(this)[0].getContext('2d');
var x = 0;
var y = 0;
var pic = new Image();
if (hexColor !== 'none') {
pic.onload = function () {
tintCtx.fillStyle = hexColor;
tintCtx.fillRect(x,y,20,20);
tintCtx.globalCompositeOperation = "destination-atop";
tintCtx.drawImage(pic, x, y);
ctx.drawImage(pic, x, y, pic.width = 20, pic.height = 20);
ctx.globalAlpha = 0.9;
ctx.drawImage(tintCanvas, x, y);
}
} else {
pic.onload = function () {
ctx.drawImage(pic, x, y, pic.width = 20, pic.height = 20);
ctx.globalAlpha = 1;
ctx.drawImage(tintCanvas, x, y);
}
}
pic.src = icUrl;
});
}
}
Both of these layers are set to clampToGround: false but inspecting the CIMSS file the original KML overlays are set to clampToGround: true
<GroundOverlay>
<name>Image T-10</name>
<TimeSpan>
<begin>2013-05-20T10:45:00Z</begin>
<end>2013-05-20T10:45:01Z</end>
</TimeSpan>
<LatLonBox>
<north>51.9544</north>
<south>-1.9961</south>
<east>-29.00</east>
<west>-100.95</west>
</LatLonBox>
<altitudeMode>clampToGround</altitudeMode>
<Icon>
<href>http://tropic.ssec.wisc.edu/real-time/atlantic/movies/kml/tiles/G8IRNHC0-8</href>
</Icon>
</GroundOverlay>
Crashes after I load the animation, slide it to the end of animation, then rotate globe.
http://cimss.ssec.wisc.edu/tropic2/real-time/atlantic/movies/kml/tiles/RT.atlantic.g8irn.tiles.kml is the actual root of the network link. This won't even load properly. It contains five other network links inside, so I am loading the "full region" network link from inside this KML.
UPDATE: I added this original network link to the github, layer labelled "North Atlantic Infrared - Unenhanced FULL": https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-layers-skeleton.js#L238
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Infrared</name>
<open>1</open>
<Region>
<LatLonAltBox>
<north>51.9544</north>
<south>-1.9961</south>
<east>-29</east>
<west>-100.95</west>
<minAltitude>0</minAltitude>
<maxAltitude>0</maxAltitude>
</LatLonAltBox>
</Region>
<NetworkLink>
<name>Full Region</name>
<Region>
<LatLonAltBox>
<north>51.9544</north>
<south>-1.9961</south>
<east>-29</east>
<west>-100.95</west>
<minAltitude>0</minAltitude>
<maxAltitude>0</maxAltitude>
</LatLonAltBox>
<Lod>
<minLodPixels>10</minLodPixels>
<maxLodPixels>2000</maxLodPixels>
<minFadeExtent>0</minFadeExtent>
<maxFadeExtent>0</maxFadeExtent>
</Lod>
</Region>
<Link>
<href>http://tropic.ssec.wisc.edu/real-time/atlantic/movies/kml/tiles/RT.atlantic.g8irn.tiles-8.kml</href>
</Link>
</NetworkLink>
<NetworkLink>
<name>NW tile</name>
<Region>
<LatLonAltBox>
<north>51.9544</north>
<south>24.9972</south>
<east>-64.99</east>
<west>-100.95</west>
<minAltitude>0</minAltitude>
<maxAltitude>0</maxAltitude>
</LatLonAltBox>
<Lod>
<minLodPixels>1000</minLodPixels>
<maxLodPixels>5000</maxLodPixels>
<minFadeExtent>0</minFadeExtent>
<maxFadeExtent>0</maxFadeExtent>
</Lod>
</Region>
<Link>
<href>http://tropic.ssec.wisc.edu/real-time/atlantic/movies/kml/tiles/RT.atlantic.g8irn.tiles-0.kml</href>
<viewRefreshMode>onRegion</viewRefreshMode>
</Link>
</NetworkLink>
<NetworkLink>
<name>NE tile</name>
<Region>
<LatLonAltBox>
<north>51.9544</north>
<south>24.9972</south>
<east>-29</east>
<west>-64.99</west>
<minAltitude>0</minAltitude>
<maxAltitude>0</maxAltitude>
</LatLonAltBox>
<Lod>
<minLodPixels>1000</minLodPixels>
<maxLodPixels>5000</maxLodPixels>
<minFadeExtent>0</minFadeExtent>
<maxFadeExtent>0</maxFadeExtent>
</Lod>
</Region>
<Link>
<href>http://tropic.ssec.wisc.edu/real-time/atlantic/movies/kml/tiles/RT.atlantic.g8irn.tiles-1.kml</href>
<viewRefreshMode>onRegion</viewRefreshMode>
</Link>
</NetworkLink>
<NetworkLink>
<name>SW tile</name>
<Region>
<LatLonAltBox>
<north>24.9972</north>
<south>-1.9961</south>
<east>-64.99</east>
<west>-100.95</west>
<minAltitude>0</minAltitude>
<maxAltitude>0</maxAltitude>
</LatLonAltBox>
<Lod>
<minLodPixels>1000</minLodPixels>
<maxLodPixels>5000</maxLodPixels>
<minFadeExtent>0</minFadeExtent>
<maxFadeExtent>0</maxFadeExtent>
</Lod>
</Region>
<Link>
<href>http://tropic.ssec.wisc.edu/real-time/atlantic/movies/kml/tiles/RT.atlantic.g8irn.tiles-2.kml</href>
<viewRefreshMode>onRegion</viewRefreshMode>
</Link>
</NetworkLink>
<NetworkLink>
<name>SE tile</name>
<Region>
<LatLonAltBox>
<north>24.9972</north>
<south>-1.9961</south>
<east>-29</east>
<west>-64.99</west>
<minAltitude>0</minAltitude>
<maxAltitude>0</maxAltitude>
</LatLonAltBox>
<Lod>
<minLodPixels>1000</minLodPixels>
<maxLodPixels>5000</maxLodPixels>
<minFadeExtent>0</minFadeExtent>
<maxFadeExtent>0</maxFadeExtent>
</Lod>
</Region>
<Link>
<href>http://tropic.ssec.wisc.edu/real-time/atlantic/movies/kml/tiles/RT.atlantic.g8irn.tiles-3.kml</href>
<viewRefreshMode>onRegion</viewRefreshMode>
</Link>
</NetworkLink>
</Document>
</kml>
@rezn8d thanks for the extra info. Unfortunately I still wasn't able to reproduce the crash. I simplified your code down to this for testing:
var viewer = new Cesium.Viewer('cesiumContainer');
new Cesium.KmlDataSource.load('../../SampleData/kml/RT.atlantic.g8irn.tiles-8.kml', {
camera: viewer.scene.camera,
canvas: viewer.scene.canvas,
clampToGround: false
}).then(function (geoData) {
console.log('loaded kml');
viewer.dataSources.add(geoData);
viewer.flyTo(geoData);
});
Can you switch to the unminified version of Cesium and paste the callstack for the crash again? That way we know the function names and might have a better idea of what's happening. Is it the same crash every time?
If you have time, could you also track down which version of Cesium the crash starts happening in? You said it works in 1.39 but not in 1.44, but it would be really helpful to know what happens in 1.40-1.43. Thanks =)
@hpinkos I visited the site @rezn8d linked to, and I get CONTEXT_LOST_WEBGL
console log message just prior to the call stack.
Cesium currently doesn't handle the WebGL Context Lost event, as it shouldn't really happen unless the browser is completely overwhelmed. So the call stack is much less relevant, it's just the aftermath of an unhandled loss of context. Unfortunately this means it's a fairly nebulous problem, with the KML data loaded into the newer version of Cesium causing the browser to be bogged down and overwhelmed for some reason.
Still, a good local reproduce case would go a long way here. I can't reproduce it locally on my machine so far.
I can upload my code to github. I did not try versions 1.40-1.43. I had to change my proxy stuff and that was about it. Will work on that tomorrow.
Github updated: https://github.com/rezn8d/climateviewer Examples of KML animations and single image overlays are on the github
Load KML function: https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-3d.js#L964
https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-layers-skeleton.js#L238
Fukushima Radioactive Seawater Single Image: https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-layers-skeleton.js#L745
Fukushima Radioactive Seawater (Animation) https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-layers-skeleton.js#L756
THANK YOU FOR HELPING!
@tfili do you think this could be related to the Resource
changes? I looks like there are a ton of requests coming from the network links
Possibly related - this Sandcastle loads Google's sample KML ( from https://developers.google.com/kml/documentation/KML_Samples.kml - rehosted as a Gist because Google doesn't care about CORS)
There's a GroundOverlay which also doesn't load, again because of CORS, but watching the network requests, it spam loads the image over and over.
I think it is probably a Resource issue since that is the only thing I had to change when updating to 1.45 from 1.39. I just uploaded my 1.39 file: https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-3d-1.39.js#L1189
The proxy got moved to Resource: https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-3d.js#L966
I am using a simple proxy.php https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-3d.js#L16
https://github.com/rezn8d/climateviewer/blob/master/proxy.php
thank you!
I'm marking this priority - high
since this seems like a regression
For the record, the fukushima layers are loaded locally, without proxy or Resource. in the layer list: https://github.com/rezn8d/climateviewer/blob/master/dist/js/climateviewer-layers-skeleton.js#L717
"P": true, = use proxy
Therefore it has to be something more than just the use of Resource, as non-proxied layers are just added without Resource. Food for thought.
{
"I": "tmi-fallout",
"T": "kml",
"NC": true,
"R": [ -76.994, 39.821, -76.395, 40.371],
"G": "/dist/layers/kml/Three-Mile-Island-meltdown-climateviewer-3d.kmz",
"S": "Created by <a href='https://climateviewer.com/about/'>Jim Lee</a>.<br><br><a href='http://en.wikipedia.org/wiki/Three_mile_island#Accident'>Partial melt-down and radioactive release</a> occurred on March 28, 1979 as a result of a loss of coolant systems.<br><br>Radiation Emissions and Cancer Inicidence Within 10 miles of the Three Mile Island nuclear accident, 1979. Source: <a href='http://web.archive.org/web/20150504222753/http://www.southernstudies.org/2009/04/investigation-revelations-about-three-mile-island-disaster-raise-doubts-over-nuclear-plant-s'>Investigation: Revelations about Three Mile Island disaster raise doubts over nuclear plant safety</a>",
"U": "https://climateviewer.com/nuclear-reactor-map/",
"N": "1979 Three Mile Island Fallout"
},
{
"I": "fuku-tsunami-seawater",
"T": "kml",
"R": [ 130, 15, 210, 45],
"G": "/dist/layers/kml/radioactive_seawater/part_51.kmz",
"S": "Ocean scientists at ASR Limited have used the Japan tsunami as a research tool to push the limits of our modelling and research capabilities. We have focussed on three aspects of the Japan event: 1) Developing and fine tuning a real time tsunami assessment tool for vulnerable ports an harbours in New Zealand. 2) Tracking the transport and distribution of debris washed in to the ocean as it crosses the Pacific Ocean and 3) Modelling the distribution of radioactive seawater emanating from the stricken Fukushima nuclear power plant.",
"U": "http://web.archive.org/web/20160313073313/http://www.asrltd.com/japan/plume.php",
"N": "2011 Fukushima Radioactive Seawater (by March 2012)"
},
{
"I": "fuku-tsunami-seawater-anim",
"T": "kml",
"H": true,
"C": true,
"R": [ 130, 15, 210, 45],
"G": "/dist/layers/kml/fukushima-radioactive-seawater-climateviewer-3d.kmz",
"S": "Ocean scientists at ASR Limited have used the Japan tsunami as a research tool to push the limits of our modelling and research capabilities. We have focussed on three aspects of the Japan event: 1) Developing and fine tuning a real time tsunami assessment tool for vulnerable ports an harbours in New Zealand. 2) Tracking the transport and distribution of debris washed in to the ocean as it crosses the Pacific Ocean and 3) Modelling the distribution of radioactive seawater emanating from the stricken Fukushima nuclear power plant.",
"U": "http://web.archive.org/web/20160313073313/http://www.asrltd.com/japan/plume.php",
"N": "2011 Fukushima Radioactive Seawater (Animation)"
},
{
"I": "fuku-tsunami-debris",
"T": "kml",
"R": [ 130, 15, 210, 45],
"G": "/dist/layers/kml/tsunami_debris/part_51.kmz",
"S": "Ocean scientists at ASR Limited have used the Japan tsunami as a research tool to push the limits of our modelling and research capabilities. We have focussed on three aspects of the Japan event: 1) Developing and fine tuning a real time tsunami assessment tool for vulnerable ports an harbours in New Zealand. 2) Tracking the transport and distribution of debris washed in to the ocean as it crosses the Pacific Ocean and 3) Modelling the distribution of radioactive seawater emanating from the stricken Fukushima nuclear power plant.",
"U": "http://web.archive.org/web/20160507040547/http://www.asrltd.com/japan/debris.php",
"N": "2011 Fukushima Tsunami Debris (by March 2012)"
},
{
"I": "fuku-tsunami-debris-anim",
"T": "kml",
"H": true,
"C": true,
"R": [ 130, 15, 210, 45],
"G": "/dist/layers/kml/fukushima-tsunami-debris-climateviewer-3d.kmz",
"S": "Ocean scientists at ASR Limited have used the Japan tsunami as a research tool to push the limits of our modelling and research capabilities. We have focussed on three aspects of the Japan event: 1) Developing and fine tuning a real time tsunami assessment tool for vulnerable ports an harbours in New Zealand. 2) Tracking the transport and distribution of debris washed in to the ocean as it crosses the Pacific Ocean and 3) Modelling the distribution of radioactive seawater emanating from the stricken Fukushima nuclear power plant.",
"U": "http://web.archive.org/web/20160507040547/http://www.asrltd.com/japan/debris.php",
"N": "2011 Fukushima Tsunami Debris (Animation)"
}
"G": = geoDataSrc
I included them in the repo now so they are loading locally, still same issue. Crash.
any updates?
@rezn8d sorry, I'm not sure if we'll have time to look at this before the June release, but we'll try to for the next one
@hpinkos thanks for the update. Looking forward to the next release.
Any chance this will get an update in the July release?
@tfili do you have a minute to look at this?
It looks like it was introduced with
https://github.com/AnalyticalGraphicsInc/cesium/commit/34c4ff9f0083aee58052429c4763f56f348c4811
@tfili I just tested version 1.46 which seems to have the fix you referenced, problem still occurs.
@rezn8d that's the commit that's causing the problem. We're going to try to fix it for the next release (1.47)
Hi @rezn8d! We fixed an issue with loading a KML file with an image that wasn't loading correctly #6710. This will be included in the upcoming 1.47 release available on July 2nd. I'm pretty sure this will fix the crash you were seeing, but if it doesn't feel free to open another issue after upgrading to 1.47. Thanks!
THANK YOU! July 2nd can't get here fast enough!
Cesium version 1.44 and 1.45 crash when loading KML files with image overlays. Files load fine, are displayed on map, then performance slows to a crawl ending with either WebGL crashing or the entire browser crashing. Crash typically happens around 10-30 seconds after file is displayed.
Tested Systems affected: Windows 7 64bit (6 core i7, 16GB RAM, SSD, NVIDIA Geforce 750GTX 2GB) on latest Google Chrome and Firefox - WebGL crash Xubuntu 16.04 with Firefox - Browser crashes Android with Firefox and Chrome (browser fully crashes)
EXAMPLE KML(s) Cooperative Institute for Meteorological Satellite Studies (CIMSS) North Atlantic Infrared - NHC Enhancement MULTIPLE IMAGE OVERLAY, ANIMATION http://climateviewer.org/index.html?layersOn=cimss-irnhc live example: http://climateviewer.org/index.html?layersOn=cimss-irnhc
Three Mile Island Meltdown SINGLE IMAGE OVERLAY http://climateviewer.org/layers/kml/pollution/nuclear/Three-Mile-Island-meltdown-Climate-Viewer-3D.kmz live example: http://climateviewer.org/index.html?layersOn=tmi-fallout
ERROR: An error occurred while rendering. Rendering has stopped. undefined TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'. TypeError: Failed to execute 'shaderSource' on 'WebGLRenderingContext': parameter 1 is not of type 'WebGLShader'. at f (http://climateviewer.org/lib/cesium/1.45/Cesium.js:20:432415) at y (http://climateviewer.org/lib/cesium/1.45/Cesium.js:20:435552) at d._bind (http://climateviewer.org/lib/cesium/1.45/Cesium.js:20:436567) at V (http://climateviewer.org/lib/cesium/1.45/Cesium.js:21:114519) at k.draw (http://climateviewer.org/lib/cesium/1.45/Cesium.js:21:118172) at n.execute (http://climateviewer.org/lib/cesium/1.45/Cesium.js:20:405485) at Ue (http://climateviewer.org/lib/cesium/1.45/Cesium.js:22:410268) at ze (http://climateviewer.org/lib/cesium/1.45/Cesium.js:22:411639) at We (http://climateviewer.org/lib/cesium/1.45/Cesium.js:22:415891) at Ke (http://climateviewer.org/lib/cesium/1.45/Cesium.js:22:420206) x.showErrorPanel @ Cesium.js:23
PLEASE, either tell me what I am doing wrong or that this can be fixed ASAP. I recently update my website from 1.39 to 1.44 and that is when this issue started. I rely on many meteorological KML files from government and universities and they use KML groundoverlays for this real-time data. ClimateViewer 3D