1. A concise explanation of the problem you’re experiencing.
At the moment, I can add points by double clicking on the terrain, when there are more than one point, a line is drawn between them and the (horizontal) distance is added to a label along the line.
I am trying to figure out how to do the same thing, but for vertical distances I can’t figure out how to add a point in a vertical context, an example would be to measure the height of a building and not just the width/depth.
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
To reproduce, double click anywhere a couple of times to add some points and for the line to be drawn between them. The distance between the points should be calculated and displayed, I’d like to calculate the vertical distance, for example, the height of a building.
I am trying to calculate the height of the click but I always seem to get ‘no cartesian’ here:
handler.setInputAction(function(click) {
var clickPosition = viewer.camera.pickEllipsoid(click.position);
var cartesian = viewer.scene.pickPosition(clickPosition);
if (cartesian) {
console.log(‘cartesian’);
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
If you haven’t seen it, the ion SDK (which builds some additional features onto CesiumJS) does have measurement tools for horizontal, vertical, or just perpendicular to any surface:
I actually just found that link a couple of hours ago.
Do you know if the ion SDK can be used but with non hosted ion assets?
e.g. We already have all the data we need so we don’t need any tile generation or cloud hosting offered by the ion service, but the SDK might be an option if it can be used on it’s own.
Also, here are some images to better explain, from the first picture you might expect the yellow dot to be the top of the building when it’s really a horizontal point in the distance.
Yes, in fact that’s currently how it’s available. It’s part of the Cesium ion on-premise tools, so you can use it locally/offline/in your own application.