1. A concise explanation of the problem you're experiencing.
When following the Cesium's hosted sandcastle example, I have a working test app that displays a polyline and point of interest on a 3D terrain. Then, when I try to update the Cesium version from the one in Sandcastle to the one that's available for download, only the globe is displayed, but my shapes are not loaded anymore.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
Following code works perfectly fine :
<!DOCTYPE html>
<html lang=‘en’>
<head>
<base href=‘https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/gallery/’>
<title>Cesium Demo</title>
<script type=‘text/javascript’ src=’../../../CesiumUnminified/Cesium.js’></script>
</head>
<body>
<style>
@import url(../templates/bucket.css);
</style>
<div id='cesiumContainer' class='fullSize'></div>
<script id='cesium_sandcastle_script'>
var geojsonTrace = {"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[5.7186,45.19431,217],[5.71867,45.19432,217],[5.71874,45.19432,217],[5.71878,45.19432,217],[5.71882,45.19432,216],[5.71886,45.19432,216],[5.71892,45.1943,216],[5.71898,45.19427,216],[5.71904,45.19423,216],[5.71907,45.19419,216],[5.71911,45.19417,216],[5.71916,45.19412,216],[5.71917,45.19406,216],[5.71916,45.19402,216],[5.71915,45.19397,216],[5.71914,45.19392,216],[5.7192,45.19389,216],[5.71928,45.19385,216],[5.71936,45.19382,216],[5.71941,45.19379,216],[5.71949,45.19376,216],[5.71956,45.19371,216],[5.71963,45.19369,215],[5.71968,45.19365,215],[5.71972,45.19363,215],[5.71981,45.19359,215],[5.71986,45.19355,215],[5.71991,45.19353,215],[5.71999,45.19351,215],[5.72005,45.1935,215],[5.72013,45.19348,215],[5.72018,45.19348,215],[5.72028,45.19348,215],[5.72039,45.19348,215],[5.72049,45.19348,215],[5.7206,45.19348,219],[5.7207,45.19348,219],[5.72081,45.19348,219],[5.72091,45.19348,219],[5.72102,45.19348,219],[5.72112,45.19348,219],[5.72119,45.19348,219],[5.72126,45.19348,219],[5.72132,45.19348,216],[5.7214,45.19348,216],[5.72148,45.19349,216],[5.72153,45.19349,216]]}};
var geojsonPoi = {
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "Point",
coordinates: [5.71874,45.19432]
},
properties: {
id: 1152,
name: "Parking",
type: 1,
type_details: 0,
pdf: true,
onScent: true
}
}
]
};
var geojsonPoiCollection = ;
geojsonPoiCollection.push(geojsonPoi);
function startup(Cesium) {
'use strict';
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: Cesium.createWorldTerrain(),
baseLayerPicker: false,
sceneModePicker: false,
animation: false,
shouldAnimate: true,
shadows: true,
timeline: false,
scene3DOnly: true,
});
viewer.scene.globe.depthTestAgainstTerrain = true;
var promises = ;
var traces = ;
var points = ;
geojsonPoiCollection.forEach(function (currentGeojsonPoi) {
promises.push(Cesium.GeoJsonDataSource.load(currentGeojsonPoi, {
clampToGround: true,
})
.then(
function (currentPoiLayer) {
viewer.dataSources.add(currentPoiLayer);
var poiEntities = currentPoiLayer.entities.values;
Array.prototype.push.apply(points, poiEntities);
for (var i = 0; i < poiEntities.length; i++) {
var entity = poiEntities[i];
var poiType = poiEntities[i].properties.type.getValue();
var poiName = poiEntities[i].properties.name.getValue();
entity.billboard.image = './poi_' + poiType + '.png';
entity.billboard.scale = 0.4;
entity.description = poiName;
}
}
)
);
});
promises.push(Cesium.GeoJsonDataSource.load(geojsonTrace, {
stroke: Cesium.Color.fromCssColorString('#2188C2'),
strokeWidth: 6,
clampToGround: true,
})
.then(
function (currentTraceLayer) {
viewer.dataSources.add(currentTraceLayer);
var traceEntities = currentTraceLayer.entities.values;
Array.prototype.push.apply(traces, traceEntities);
for (var i = 0; i < traceEntities.length; i++) {
var entity = traceEntities[i];
entity.material = new Cesium.PolylineArrowMaterialProperty(Cesium.Color.BLUE);
}
}
)
);
Promise.all(promises)
.then(
function() {
viewer.zoomTo(traces);
}
);
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
Problem occurs when I try the following (steps in the installation guide) :
- Remove <base href=‘https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/gallery/’>
- Change <script type=‘text/javascript’ src=’../../../CesiumUnminified/Cesium.js’></script> to my downloaded Cesium.js file
- Change @import url(../templates/bucket.css); to Widgets/widgets.css
My browser's console outputs the following errors:
[Error] Failed to load resource: the server responded with a status of 403 (Forbidden) (approximateTerrainHeights.json, line 0)
[Error] Failed to load resource: the server responded with a status of 403 (Forbidden) (IAU2006_XYS_15.json, line 0)
Those files do exist in the Assets folder, and I didn't make any changes to the file permissions, which are currently read/write for everyone.
There's also this :
[Error] Blocked script execution in 'about:blank' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
(anonymous function) (kwift.SAFARI.min.js:1:68912)
(anonymous function) (kwift.SAFARI.min.js:1:69399)
(anonymous function) (kwift.SAFARI.min.js:1:85697)
Global Code (kwift.SAFARI.min.js:1:249722)
But I'm not sure it's relevant as I did have the same kwift.Safari error with the sandcastle example and it worked anyway.
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I need to install the downloadable version of Cesium as it's written in the documentation that we should use this one, not the one hosted in the code samples.
4. The Cesium version you're using, your operating system and browser.
I don't know which version is hosted, but tried to replace it with versions 1.45 and 1.46 without success. Tested on Mac OS 10.13.5. Safari 11.1.1, Chrome 67.0.3396.87, Firefox 60.0.1, Opera 51.0.2830.40.
Thanks for your support.