Hi, I have northing/easting coordinates in UTM zone 31N, how can I convert them to lat/lon or any other format that Cesium understands programmatically? In case that is not easy, and as UTM zones are a bit irregular, is there an approximation assuming “regularized” UTM zones?
Hi @Patins,
it depends on what you want to transform.
If it’s only the coordinates, proj4js (another JavaScript library) can help you. I use it for conversion between UTM 32N and WGS84.
Code example:
var utm = "+proj=utm +zone=32";
var wgs84 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
var northing = parseFloat(document.getElementById("northing").value);
var easting = parseFloat(document.getElementById("easting").value);
var height= parseFloat(document.getElementById("height").value)
var coordinates = proj4(utm, wgs84, [easting, northing]);
var position = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], height);
//position is Cartesian (ECEF, EPSG:4978) not WGS84
If you want to transform Data, you will have to use some CesiumIon features or some GIS-Software.
Best, Lennart
2 Likes