How to convert x,y,z to longitude, latitude, altitude?

Hi,

I’ve some models in the database with references to x,y,z. I wanted to load those 3D models into cesium as longitude, latitude and altitude value with reference to some longitude, latitude as origin.

E.g.,

Model Name : Floor1

Coordinates (x, y, z) : (-150.9, 126.26, 217.7)

Origin (Longitude, Latitude) : (-106.690647, 36.806761)

Position on Cesium: (longitude, latitude, altitude) : (?, ?, ?)

``

Can anyone show some lights to figure it out!

Advice/help is greatly appreciated!

Thank you,

Premkumar

To convert from lla to cartesian do this...
var cartesian = new Cesium.Cartesian3.fromDegrees(longitude, latitude, altitude);

It depends on the coordinate system for (x, y, z). Here is an example if (x, y, z) is (east, north, up):

var billboards = scene.primitives.add(new Cesium.BillboardCollection());

var center = Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883);

billboards.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(center);

var facilityUrl = ‘…/images/facility.gif’;

// center

billboards.add({

image : facilityUrl,

position : new Cesium.Cartesian3(0.0, 0.0, 0.0)

});

// east

billboards.add({

image : facilityUrl,

position : new Cesium.Cartesian3(1000000.0, 0.0, 0.0)

});

// north

billboards.add({

image : facilityUrl,

position : new Cesium.Cartesian3(0.0, 1000000.0, 0.0)

});

// up

billboards.add({

image : facilityUrl,

position : new Cesium.Cartesian3(0.0, 0.0, 1000000.0)

});

From https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Billboards.html&label=Showcases

Patrick

Hi,

Thank you for the response.

From the example I understand how we could load image with reference to (east, north, up).

But I’'m working on a different scenario. Using three.js library I’ve constructed a model (assembled building). That model will contains of so many smaller models which have the reference of position in (x,y,z). Now I wanted to load those completed model into Cesium. When I try to load the model into Cesium by directly converting the position (x,y,z) to (north, east, up) the result is not as I expected. All the models are scattered.

The functionality, which I’m trying to achieve is, based on some origin (longitude, latitude, altitude) point, I should position the model into cesium with reference of (x,y,z) relative to cesium coordinates (long, lat, alt).

I’ve tried with the below article to convert the (x,y,z) to the (long, lat, alt) with some origin (long, lat, alt), but no luck :frowning:

http://www.whoi.edu/marine/ndsf/cgi-bin/NDSFutility.cgi?form=0&from=XY&to=LatLon

Can you guide me with the better solution.

Note:

I want to load different set of models which was configured in three.js library to the cesium with different geo coordinate position.

(E.g. load some set of constructed building in x geo coordinates and load some shopping mall in y geo coordinates).

Thanks,

Premkumar