I have a home page at ISP home.kpn.nl/udo00026 and would like to display (gpx/kml) tracks in Cesium 3D world. (Previously I used GoogleEarth for this.)
On my localhost develop system there is no problem: downloaded the Cesium 1.44 version, use the new Cesium.createWorldTerrain server and its API.
Now I would like to transfer the Cesium/javascript code to the ISP and use the on-line version of Cesium https://cesiumjs.org/Cesium/Build/Cesium/Cesium.js
I'm pretty sure that I miss something.
A small example of the code is here:
http://home.kpn.nl/udo00026/Cesium_3D_World_NewTerrainProvider_KPN.html
Hi Robert,
https://cesiumjs.org/Cesium/Build/Cesium/Cesium.js is updated with the latest version of Cesium, but it’s not an official CDN, so we don’t necessarily support any problems you may have when using that URL directly.
I would recommend uploading the built version of Cesium you used for development to your server along with your app code.
Thanks!
Gabby
Hi,
Could you please let me know how to add SRTM DTM data and Landsat imagery on Cesium Globe (Localhost)
Please…
Akshay Gore
Hi,
Could you please let me know how to add SRTM DTM data and Landsat imagery on Cesium Globe (Localhost)
Please…
Akshay Gore
Hi Akshay,
Take a look at the Cesium Terrain Tutorial and Imagery Tutorial. That should get you started.
Thanks,
Gabby
Hello Gabby,
I’ve uploaded the Cesium 1.29 version to the ISP. I do have a 3D world model (of a favorite spot in the Pyrenees). However, I don’t see a track (just a few points) nor a billboard. The are in the javascript source code. Can you please have a look to see what I miss?:
http://home.kpn.nl/udo00026/Cesium_3D_World_KPN.html
I still wonder that the message at the bottom tells me that this version of 3D world will be outdated soon while the new Cesium 3D version is experimental?
Kind regards,
Rob Udo
Hi Rob,
Is there a particular reason you are using 1.29 instead of 1.44 (or 1.45 which will be released later today)?
I copy/pasted your script into Sandcastle, and it works there (though you may want to update to Cesium World Terrain, and use an ion key instead of Bing).
Also if you’d like to clamp your polylines to terrain, that will come out soon, probably around June.
Thanks,
Gabby
Hello Gabby,
Using Sandcastle is not what I want (nor is an option). If you have a look at one of my blogs e.g. http://home.kpn.nl/udo00026/15Kreta/_Verslag.html
you find a small menu on the picture with (a part of) the map of Crete. Choices are:
-
Google Maps -> map of Crete with track and icons
-
Cesium 3D Earth -> ??
-
Google Earth -> angry smiley
When GE was still “alive” the google 3D earth popped up with the track (polylines) and small icons. (Clicking the icons shows a picture.) It’s a shame that google removed the API for GE. But, the good news is that Cesium may be an alternative. So I spent quite a lot of effort to move to Cesium.
At my development PC it works fine (with 1.29), but I do have problems with 1.44 to display billboards. To be solved in future?
The real problem, however, is that if I copy all scripts + Cesium.1.29 to the ISP I get the error message (from FireBug): “Cesium is not defined”.
Any idea? I appreciate all help on this topic!
Regards,
Rob
Hi Rob,
If you are getting a “Cesium is not defined,” error, something is going wrong with importing the Cesium object. Try following the Cesium Getting Started tutorial and see if you have the same issue.
What problem are you having with billboards? It appears with your code you should do the following, and the billboard appears:
var position = Cesium.Cartesian3.fromDegrees(-0.14532, 42.78988, 2202);
map.entities.add({
position : position,
billboard :{
image : ‘…/images/Cesium_Logo_overlay.png’,
verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
width: 120,
height: 90
}
});
``
Thanks,
Gabby
Hi Gabby,
I still didn’ t succeed to put my example app on the ISP to display the Cesium 3D world with a Track and Image.
If I use the on-line version of Cesium “https://cesiumjs.org/Cesium/Build/Cesium/Cesium.js” I get the (debugger) message: “ReferenceError: Cesium is not defined”.
If I upload the relevant part of Cesium (issue 1.44 which I use locally on the development PC) to the ISP then I get a 3D world, but still no Track and Image (and no message in the debugger).
The same locally installed on my development PC shows the 3D world with Track and Image.
I did a survey on the “Cesium Getting Started”, the examples and the Cesium FAQ but couldn’t find any relevant hint.
Can you please have a look at http:home.kpn.nl/udo00026/Cesium_3D_World_Web_NewTerrainProvider.html
Best regards,
Rob
Rob-
I pasted your script in sandcastle on my localhost, and I was puzzled by the behavior you described: the polyline draws on top of terrain on my localhost, but not on your webhost.
In sandcastle, I modified your script to baseLayerPicker: true,
I changed the terrain choice to the WGS84 ellipsoid, and the polyline track displayed, hovering 2000+ meters above the elllipsoid.
I changed the terrain choice back to Cesium World Terrain, and the polyline track disappeared underneath the 3D terrain.
I modified your script, adding 10000 meters to exagerate the altitudes;
then the polyline did NOT disappear underneath the 3D terrain, when toggling back and forth between the ellipsoid and Cesium World Terrain.
I think there are 2 issues.
First, the elevation/altitude Z values in your track are below the Cesium World Terrain.
You will need to increase the Z values of your Track polyline coordinates. If you can figure out how to use sampleTerrainMostDetailed, that might solve the issue. If the Cesium team would get polylines clampToGround working, that may also solve the issue.
I hope the Cesium team accomplishes the long-overdue polyline clampToGround feature in June(?!?). I struggled again this weekend attempting unsuccessfully to get my GPS tracks on top of terrain, using sampleTerrainMostDetailed. Chaining promises for one more async function has exceeded my programming skills, in the free time I had available.
The second issue is that different behavior occurs in Sandcastle than on your webhost.
Gabby, why does the track polyline render on top of this 3D terrain initially in Sandcastle on Localhost (and the online Sandcastle), but not his Webhost?
It should render underneath terrain in both cases.
Does it have something to do with the minified Cesium Build used on the webhost versus the unminified Cesium source used in Sandcastle?
Good luck, Rob! I share your pain with polylines on terrain. I have no idea why the red map marker pin (billboard) would not display.
-Jon “Left Gully”
Cesium.BingMapsApi.defaultKey = ‘Aom2vE0RuXkxP1q_HNC7ZIsOrwBM10E36Ilf4xNR5YjDoodbMIR-0dlHZRHomJ7U’;
var map = new Cesium.Viewer(“cesiumContainer”, {
animation: false,
automaticallyTrackDataSourceClocks: false,
baseLayerPicker: true, //false,
//terrainProvider: new Cesium.createWorldTerrain(),
bottomContainer: {hidden:true},
//creditContainer: " ",
fullscreenButton: false,
geocoder: false,
homeButton: false,
infoBox: true,
mapProjection: new Cesium.WebMercatorProjection(),
navigationInstructionsInitiallyVisible: false,
scene3DOnly: true,
selectionIndicator: false,
//vrButton: true, //virtual reality: depth in screen
//imageryProvider : Cesium.createOpenStreetMapImageryProvider({
// url : ‘https://a.tile.openstreetmap.org/’
//}),
timeline: false
});
// OLD OLD OLD
//var terrainProvider = new Cesium.CesiumTerrainProvider({
// url: ‘https://assets.agi.com/stk-terrain/world’,
// requestVertexNormals: true
//});
// NEW NEW NEW: As per 1 sept 2018 the provider below is Deprecated; use the Cesium.createWorldTerrain in stead
var terrainProvider = new Cesium.createWorldTerrain({
requestVertexNormals: true
});
map.terrainProvider = terrainProvider;
map.scene.fxaa = false; // sharper image :O)
// set center
map.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(-0.14608, 42.78951, 5000),
orientation: {
heading: Cesium.Math.toRadians(180.0),
pitch: Cesium.Math.toRadians(-90.0),
roll: 0.0
}
});
var track = [
[-0.15133, 42.79047, 2468],
[-0.14937, 42.79080, 2409],
[-0.14980, 42.78981, 2383],
[-0.14811, 42.78983, 2327],
[-0.14697, 42.78899, 2283],
[-0.14646, 42.78972, 2251],
[-0.14608, 42.78951, 2235],
[-0.14532, 42.78988, 2202],
[-0.14375, 42.79063, 2154],
[-0.14304, 42.79140, 2149],
[-0.14256, 42.79240, 2149],
[-0.14125, 42.79291, 2151],
[-0.14125, 42.79291, 2151]
];
var coords = ;
for (var i=0; i<track.length; i++) {
coords[i] = Cesium.Cartesian3.fromDegrees(track[i][0], track[i][1], track[i][2]);
}
var line = map.entities.add({
polyline: {
show: true,
positions: coords,
width: 2,
material: Cesium.Color.RED
}
});
function lonLatPicture(lon, lat, alt, theImage, x, y) {
theImage.onload = function() {
map.entities.add({
position: Cesium.Cartesian3.fromDegrees(lon, lat, alt),
billboard: {
image: theImage,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
width: x,
height: y
}
});
};
}; // lonLatPicture
var theImage = new Image();
if (location.hostname === “localhost”)
theImage.src = “//localhost/Pictures/FlagGreen.png”;
else
theImage.src = “./Pictures/FlagRed.png”;
lonLatPicture(-0.14125, 42.79291, 2151, theImage, 70, 70);
``
Cesium-
Look at this other issue, as well.
https://groups.google.com/forum/m/#!topic/cesium-dev/24rOR01Q2nk
Both issues occur using Cesium World Terrain, after you toggle the terrain provider to the ellipsoid and back again to world terrain. Thx.
Hi Jon,
First of all thanx for your experiments. My time is limited as yours. Some remarks on your comments/findings:
I pasted your script in sandcastle on my localhost, and I was puzzled by the behavior you described: the polyline draws on top of terrain on my localhost, but not on your webhost.
In sandcastle, I modified your script to baseLayerPicker: true,
Yes! The baseLayerPicker is fun!
- I
changed the terrain choice to the WGS84 ellipsoid, and the polyline track displayed, hovering 2000+ meters above the elllipsoid.*
When I toggle between the Bing Map Aerial and the WGS84 ellipsoid I don’t see any diff, no tracks at all…
I changed the terrain choice back to Cesium World Terrain, and the polyline track disappeared underneath the 3D terrain.
I modified your script, adding 10000 meters to exagerate the altitudes;
I added also 1000m to the track alti’s but even than the track didn’t pop up :O(
BTW, the alti’s are the real altitudes taken from a gps device when we made that hike.
- then
the polyline did NOT disappear underneath the 3D terrain, when toggling
back and forth between the ellipsoid and Cesium World Terrain.*
I think there are 2 issues.
*First, the elevation/altitude Z values in your track are below the Cesium World Terrain. *
- You
will need to increase the Z values of your Track polyline coordinates.
If you can figure out how to use sampleTerrainMostDetailed, that might solve the issue. If the Cesium team would get polylines clampToGround working, that may also solve the issue. *
If the real alti’s are available then it is not a nice thing to add extra artificial height meters to the data. The data is used for plots and analysis as well. Terrain clamping should do the job for displaying the track in the Cesium map. (-> Gabby?)
- I hope
the Cesium team accomplishes the long-overdue polyline clampToGround feature in June(?!?). I struggled again this weekend attempting unsuccessfully to get my GPS tracks on top of terrain, using sampleTerrainMostDetailed. Chaining promises for one more async function has exceeded my programming skills, in the free time I had available.*
The second issue is that different behavior occurs in Sandcastle than on your webhost.
This one is really frustrating. Why is there different behavior between my local development PC and the same code (Cesium 1.44 + test app) on the web host. I’m looking forward for an explanation…, since I’m not sure I do the right things. By uploading the same (stripped) Cesium 1.44 version from development PC to web host (as suggested by Gabby) I expected the same behavior.
Thanx for sharing some pain with polylines on terrain :O)
Rob
I added also 1000m to the track alti’s but even than the track didn’t pop up :O(
BTW, the alti’s are the real altitudes taken from a gps device when we made that hike.
If the real alti’s are available then it is not a nice thing to add extra artificial height meters to the data. The data is used for plots and analysis as well. Terrain clamping should do the job for displaying the track in the Cesium map. (-> Gabby?)
The second issue is that different behavior occurs in Sandcastle than on your webhost.
This one is really frustrating. Why is there different behavior between my local development PC and the same code (Cesium 1.44 + test app) on the web host. I’m looking forward for an explanation…, since I’m not sure I do the right things. By uploading the same (stripped) Cesium 1.44 version from development PC to web host (as suggested by Gabby) I expected the same behavior.
Thanx for sharing some pain with polylines on terrain :O)
I agree, my GPX tracklog files with “real” altitudes disappear under Cesium World Terrain in places, but I can explain it. I ski wearing GPS down steep mountain avalanche terrain that are water drainages, we call it a “gully” in New Hampshire. When building contour lines, there should be “break lines” used on top of the digital elevation model to force the triangulated irregular network “TIN” to build polygon edges in the 3D surface. Without those “break lines”, the 3D surface polygons represent an average elevation that does not represent the actual GPS path elevation.
If you look at this picture, rock walls on either side of us are at a higher elevation.
If you click the “GPX” button in the Cesium map frame on this page, the GPX track displays as an animated CZML data source, and disappears under the terrain for significant portions of the mountainside descent, which correlate to places where the surrounding terrain are rock walls above my head.
https://lftgly.com/wordpress/?p=854
I hope the Cesium.js core will soon support clampToGround for polylines, to simplify solving the display of data like our GPX files. Google Earth has supported this for years. Cesium positioned themselves as a migration path from the GE browser plugin for developers, but never finished this ClampToGround feature for polylines.
We’ve got Materials on polygons clamped-to-ground coming in June, but still no line features !!! I’m going to take a break from Cesium development, and try again later this year, if/when the polyline clampToGround feature ever gets released.
We are indeed working on Polylines on terrain! See our progress in Issue #2172.
I think that the difference between local development and Sandcastle may be the Cesium version. Sandcastle is running 1.45, so there may have been a change between the two versions that affects this. You can run older versions of Sandcastle from the downloads page, by scrolling to the version number under the “Downloads Archive” and clicking “Docs, Examples, & Tests”.