In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to load irregular shapes in Cesium", the content is simple and clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "how to load irregular shapes in Cesium" this article.
In the development of Cesium map system, the range of background map is an irregular polygon in longitude and latitude, and the shape of the picture is not regular. If you want to paste this picture on the map, the range of the picture should be in line with the actual map location.
Picture effect:
To find the interface of Cesium, the first thing that comes to mind is to use the polygon to draw a polygon according to the range of longitude and latitude, and then paste the picture as a material material, but after the code is written, the map found is deformed in polygon and has not been posted to the corresponding map location.
After testing, it is found that the Rectangle solid object of Cesium can be used to calculate the coordinates of the upper left corner and the lower right corner of the irregular polygon range, and then paste the picture material on the map, the position on the map is also right.
The specific code is as follows:
/ / add an entity of rectangle
Viewer.entities.add ({
Name: 'irregular mapping'
Rectangle: {
/ / set the four coordinate ranges of rectangle
Coordinates: Cesium.Rectangle.fromDegrees (- 92.0,30.0,-76.0,40.0)
/ / set the picture to material
Material: 'data/wind_500_2018030616_True.png'
/ / Image display style type, with terrain, model or both, this effect can achieve the effect that the map is along the
/ / of the curved surface of the map
ClassificationType: Cesium.ClassificationType.TERRAIN
}
After the addition is completed, the effect is close to the ground and the shape is rectangular, but the blank space is black. To set it separately in the material, change the material properties to the following: black is gone.
Material: new Cesium.ImageMaterialProperty ({
Image:'data/wind_500_2018030616_True.png'
Transparent:true
})
/ / set a height property by the way, which can be displayed off the ground.
Height:70000
Finish the effect picture:
These are all the contents of the article "what to do when loading irregular shapes in Cesium". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.