所谓四至坐标,也就是东西南北各有一个值,如何转换成经纬度坐标?
let coor = obj.rectangle.coordinates._value;
const northwest = Cesium.Rectangle.northwest(coor);
const southwest = Cesium.Rectangle.southwest(coor);
const northeast = Cesium.Rectangle.northeast(coor);
const southeast = Cesium.Rectangle.southeast(coor);
const leftTop = [Cesium.Math.toDegrees(northwest.longitude),Cesium.Math.toDegrees(northwest.latitude)]
const leftBottom = [Cesium.Math.toDegrees(southwest.longitude),Cesium.Math.toDegrees(southwest.latitude)]
const rightTop = [Cesium.Math.toDegrees(northeast.longitude),Cesium.Math.toDegrees(northeast.latitude)]
const rightBottom = [Cesium.Math.toDegrees(southeast.longitude),Cesium.Math.toDegrees(southeast.latitude)]
newObj = { rectangles:[leftTop.join(';'),leftBottom.join(';'),rightTop.join(';'),rightBottom.join(';')] };
网友评论