Kriging on Cesium

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

I want to interpolate with Kriging. What should be my attention areas in Cesium and how I can proceed?

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

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

4. The Cesium version you're using, your operating system and browser.

Do you mean you have a set of points and you’re trying to create and visualize surface geometry approximated by kriging?

There’s nothing built-in to CesiumJS to do this, but could do your computations in JavaScript in your app and then have Cesium visualize the results, as geometry or lines in 3D etc.

Hi Omar,

Yes, the same intent is expected.

However, for the time being I am working with kriging datasets as sampled data with easting and northing and then finally implementing the kriging on the points collected from sampleTerrainMostDetailed.

But the conversion of points from cartesian to cartographic in cesium, I am always getting the latitudes as 0,

var cartesianCoordinate = new Cesium.Cartesian3(8600/*Easting*/,12600/*Northing*/);
var cartograhicCoordinate = Cesium.Cartographic.fromCartesian(cartesianCoordinate );

cartograhicCoordinate.latitude is always 0

Cesium’s Cartesian3 coordinates are not a 2 dimensional grid on the surface of the Earth. It’s a 3D coordinate system with the point (0, 0, 0) being in the center of the earth.

I think what you’ll need to do is convert your easting and northing values to longitude/latitude, and then create a new Cesium.Cartographic() from that.

Hi Omar,

I have created a krigging layer on 2D canvas, and bringing it over the cesium in the form of a rectangle, but however when it lays over the cesium globe, the canvas positions do not exact position on the cesium map.

What factors do I need to take care for proper alignment?
I am using aspect ratio as 1:1 and pixel size as 1 to create krigged map on separate 2d canvas.

Thanks,
Tushar

How are you currently adjusting the position of the rectangle on the 3D globe? Do you have the latitude/longitude of where the corners of the rectangle are supposed to be?

You can use this SceneTransforms function to convert from a 3D world position to a 2D position on the screen:

https://cesiumjs.org/Cesium/Build/Documentation/SceneTransforms.html#.wgs84ToWindowCoordinates

Or for the opposite transformation, there is pickEllipsoid:

https://cesiumjs.org/Cesium/Build/Documentation/Camera.html?classFilter=Camera#pickEllipsoid

Or if you’re using terrain, then pickPosition:

https://cesiumjs.org/Cesium/Build/Documentation/Scene.html?classFilter=scene#pickPosition

I have around 10 cartesian positions and I calculated the minimum bounds and maximum bounds from these positions like

minBounds = [minLongitude,minLatitude];
maxBounds = [maxLongitude,maxLatutude];

and I calculated the cartesian2 of minBounds and maxBounds using SceneTransforms.

I have created a rectangle using these minBounds and maxBounds

Now I want to set the canvas image in this rectangle and lay that rectangle on an elevated surface. The positions in the image should collide with the positions on cesium globe.

Problem is that when I lay canvas image on this rectangle, only a proportion of image is laid on rectangle, not the complete generated image. I want to frame the complete canvas image in the rectangle.

Primitive appearance material is not accepting the canvas image.

This is a good reference on the materials in Cesium:

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=Materials.html

You should be able to pass a canvas as an image. This issue has an example of doing it with entities:

https://github.com/AnalyticalGraphicsInc/cesium/issues/2821

If that’s not working for you, can you provide a Sandcastle example with your code that I can run?