What is calculation of Line of sight in cesuim and projections over the building thru human vision

1. A concise explanation of the problem you're experiencing.

i am not able find exact calculation to find line of sight calculation from one latitude and longitude with human vision over buildings

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.


var theta=360 ; //bearing in degre
                              var R= 5000 ; // distance in meters
                    for(var i=0;i<=theta;i++){
                                          var dx1 = R * Math.cos(i) ;

                        var dy1 = R * Math.sin(i);
                        var delta_longitude1 = dx1/(111320*Math.cos(42.25732445310803));

                        var delta_latitude1 = dy1/110540;

                        Final_longitude1 = longitude + delta_longitude1;
                        Final_latitude1 = latitude + delta_latitude1;

                        var value=longitude+","+latitude+","+height+","+Final_longitude1+","+Final_latitude1+","+height;
                        var arr=[value];
                        var res = value.split(",");
                         glowingLine = viewer.entities.add({
                        name : 'Glowing blue line on the surface',
                        polyline : {
                        //positions : Cesium.Cartesian3.fromDegreesArray(res),
                        positions : Cesium.Cartesian3.fromDegreesArrayHeights(res),
                        width : 1,
                        material : Cesium.Color.ORANGE.withAlpha(0.5),

Your example seems to be trying to show the rays from your center point, but you’ve left out the latitude and have included a couple of ‘magic’ numbers (111320 and 110540). Below is an example of computing and drawing the rays.

Hope that helps.

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var thetaMax = 360; //bearing in degrees

var dTheta = 10;

var R = 5000; // distance in meters

var centerLLH = Cesium.Cartographic.fromDegrees(-75.5966, 40.0386 , 0.0);

var centerXYZ = Cesium.Cartographic.toCartesian(centerLLH);

// We’ll need the transformation from local coordinates to Earth-Centered, Earth-Fixed

var enuTransform = Cesium.Transforms.eastNorthUpToFixedFrame(centerXYZ);

for (var theta = 0; theta < thetaMax; theta += dTheta) {

var dX = R * Math.cos(Cesium.Math.toRadians(theta)) ; 

var dY = R * Math.sin(Cesium.Math.toRadians(theta)); 

var limitENU = new Cesium.Cartesian4(dX, dY, 0.0, 1.0);

// Transform point in local coordinate system (East-North-Up) to ECEF

var limitECF = new Cesium.Cartesian4();

limitECF = Cesium.Matrix4.multiplyByVector(enuTransform, limitENU, limitECF);

var glowingLine = viewer.entities.add({

    name : 'Ray at ' + theta + ' degrees ENU',

    polyline : {

        positions : [




        width : 1,

        material : Cesium.Color.ORANGE.withAlpha(0.5),        




var centerEntity = viewer.entities.add({

name: 'Center',

position: new Cesium.ConstantPositionProperty(centerXYZ),

point: {

    size: 8





Hi Scott Reynolds,

Thanks for the amazing help.

I request to share calculations on restricting line of sight projections over other buildings.

I could not find the calculations, where the line of sight rays are projected over all buildings.

**For example, there is a building, the light cannot pass thru the 3rd building where it has to stop, if the light is hitting to second building, **

can u share, how the restrictions can be done?

That would be more helpful.

Thanks in advance



Hi Scott ,

I have received error as “ces_example.html:45 Uncaught TypeError: Cesium.Cartographic.toCartesian is not a function” in my html .

but in sandcastle,its working fine. Can you help me out. is that any problem with version ? or any other thing.



That was a function added in a recent release, try downloading and using the latest version of Cesium.

Thank you. Will check.

Hi Gabby,

Please, tell us exactly what function you mean?

Thanx in advance.



Also, the ion SDK does have some pretty cool tools for doing this kind of visibility analysis that you can buy as an add-on to CesiumJS:

Thank you, Omar! I’ll look this.