const minx="123.37677058060989"
const miny="41.62629210513693"
const maxx="123.664502793"
const maxy="41.88914398693785"
I loaded a webmapserviceimageryprovider and got the bounding box of this layer. How should I zoom to this bounding box
const minx="123.37677058060989"
const miny="41.62629210513693"
const maxx="123.664502793"
const maxy="41.88914398693785"
I loaded a webmapserviceimageryprovider and got the bounding box of this layer. How should I zoom to this bounding box
Make a Rectangle
and use it with Camera#setView()
or Camera#flyTo()
.
https://cesium.com/learn/cesiumjs/ref-doc/Camera.html?classFilter=camera#setView
let Rectangle = Cesium.Rectangle.fromDegrees(123.37677058060989,41.62629210513693,123.664502793,41.88914398693785)
viewer.camear.flyTo({destination:Rectangle})
I use this method to locate the bounding box, but it does not completely locate my layer. As shown in the picture, some elements overflow the screen. How can I locate my layer more accurately
I didn’t try this very deeply.
I think you should make sure your data is right first, then try to increase the range.
You could also set a certain view with position
, up
and direction
property of camera
.