当前位置:网站首页>Cesium load vector data
Cesium load vector data
2022-07-07 09:11:00 【FOR. GET】
Vector data introduction
stay GIS in , For the classification of data formats , We generally divide it into two types: raster data and vector data . raster data ( Image data ) It is to regard space as discrete pixels , Expressed by two-dimensional array or other data organization . Vector data is just the opposite , It regards space as continuous , Use elements ( spot 、 Line 、 Noodles ) To express . stay GIS The most familiar vector data in application is Shpfile, More about vector data viewing .
Cesium Vector data formats that can be directly supported include :geojson、topojson、kml And with time characteristics czml
Online tool recommendation
- JSON Online parsing and formatting :https://www.json.cn/
- Online generation GeoJSON:http://geojson.io/
- shp Data transfer GeoJSON and TopoJSON:http://mapshaper.org/
- GeoJson and TopopJson Online conversion :http://jeffpaine.github.io/geojson-topojson/
One 、 load GeoJSON & TopoJSON
【 The official sample 】GeoJSON & TopoJSON
1.1 GeoJSON & TopoJSON brief introduction
- GeoJSON & TopoJSON Format comparison , The biggest difference is TopoJSON Merge two connected edges into one , Greatly reduce the data storage space .
GeoJSON
Format : My understanding is thatPython
Complex dictionary ,【 The address of the screenshot 】 To view the . Form the following :
Local
shp
Files are exported on this website , But not recommended ( Data security issues ). You can also useCesium
Laboratory to carry out data conversion ,ArcMap
It's OK , It is best toArcMap
turn , The safest .Remember to turn shp Change the coordinate system to wgs-84 Oh ! Or Mercator
1.2 load GeoJSON & TopoJSON
【 Official loading GeoJSON
file 】GeoJSON
The following code is through
Django
Framework to achieve , Combined with official examples
- GeoJSON
<script>
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.GeoJsonDataSource.load('{% static "GIS/json/china.json" %}', {
stroke: Cesium.Color.HOTPINK,
fill: Cesium.Color.PINK.withAlpha(0.5),
strokeWidth: 3
}));
</script>
- TopoJSON
var dataSource = viewer.dataSources.add(
Cesium.GeoJsonDataSource.load("/static/data/ne_10m_us_states.topojson")
);
Two 、 load KML
KML (keyhole markup language)
It's based onXML
Syntax format file , Used to describe and store geographic information data ( spot 、 Line 、 Noodles 、 polygon 、 Polyhedron and model, etc ), Usually applied toXML
The biggest difference between files is KML It describes geographic information data , meanwhileKML
Has been officiallyOGC
use , BecomeOGC
One of many specifications .KML
The file has two file extensions :.KML
and.KMZ
( One or moreKML
Compressed set of files , usezip
Format compression )
var options = {
camera: viewer.scene.camera,
canvas: viewer.scene.canvas,
};
var dataSource = Cesium.KmlDataSource.load(
"/static/data/kml/gdpPerCapita2008.kmz",
options
);
viewer.dataSources.add(dataSource);
viewer.camera.flyHome(0);
3、 ... and 、 load CZML
CZML
It's a kind ofJSON
Format string , Used to describe time-related animation scenes ,CZML
Include a point 、 Line 、 landmark 、 Models and other graphical elements , It also shows how these elements change over time .Cesium Have a set of rich clientsAPI
, adoptCZML
Adopt a data-driven approach , Without writing code, I can use generalCesium viewer
Build rich scenes . More about CZML Check out the links
var dataSource = Cesium.CzmlDataSource.load("/static/data/Vehicle.czml");
边栏推荐
- How long does the PMP usually need to prepare for the exam in advance?
- Druid monitoring - Introduction to JMX usage and principle
- Interpretation of MySQL optimization principle
- 模拟卷Leetcode【普通】1609. 奇偶树
- STM32的时钟系统
- Three updates to build applications for different types of devices | 2022 i/o key review
- Postman interface test (II. Set global variables \ sets)
- Count the number of words in the string c language
- Cmake command line use
- MySQL主从延迟的解决方案
猜你喜欢
Storage of data in memory
Locust performance test 5 (analysis)
C language for calculating the product of two matrices
Selenium mouse sliding operation event
【istio简介、架构、组件】
2022-07-06 Unity核心9——3D动画
硬核分享:硬件工程师常用工具包
数据在内存中的存储
Recommended by Alibaba P8, the test coverage tool - Jacobo is very practical
PPT模板、素材下载网站(纯干货,建议收藏)
随机推荐
【ChaosBlade:节点 CPU 负载、节点网络延迟、节点网络丢包、节点域名访问异常】
MySQL主从延迟的解决方案
Alibaba P8 teaches you how to realize multithreading in automated testing? Hurry up and stop
Systick滴答定时器
面试题:高速PCB一般布局、布线原则
Postman interface test (I. installation and use)
Reflections on the way of enterprise IT architecture transformation (Alibaba's China Taiwan strategic thought and architecture practice)
PMP examination experience sharing
2022-06-30 Unity核心8——模型导入
C language pointer (Part 2)
STM32串口寄存器库函数配置方法
Pytest+request+allure+excel interface automatic construction from 0 to 1 [five nails / flying Book notice]
[chaosblade: node disk filling, killing the specified process on the node, suspending the specified process on the node]
【ChaosBlade:根据标签删除POD、Pod 域名访问异常场景、Pod 文件系统 I/O 故障场景】
Simple use of Xray
模拟卷Leetcode【普通】1705. 吃苹果的最大数目
Summary of PMP learning materials
Several common database connection methods
PMP Exam Preparation experience, seek common ground while reserving differences, and successfully pass the exam
Esp32-ulp coprocessor low power mode RTC GPIO interrupt wake up