当前位置:网站首页>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 .
GeoJSONFormat : My understanding is thatPythonComplex dictionary ,【 The address of the screenshot 】 To view the . Form the following :
Local
shpFiles are exported on this website , But not recommended ( Data security issues ). You can also useCesiumLaboratory to carry out data conversion ,ArcMapIt's OK , It is best toArcMapturn , 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
DjangoFramework 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 onXMLSyntax format file , Used to describe and store geographic information data ( spot 、 Line 、 Noodles 、 polygon 、 Polyhedron and model, etc ), Usually applied toXMLThe biggest difference between files is KML It describes geographic information data , meanwhileKMLHas been officiallyOGCuse , BecomeOGCOne of many specifications .KMLThe file has two file extensions :.KMLand.KMZ( One or moreKMLCompressed set of files , usezipFormat 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
CZMLIt's a kind ofJSONFormat string , Used to describe time-related animation scenes ,CZMLInclude 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, adoptCZMLAdopt a data-driven approach , Without writing code, I can use generalCesium viewerBuild rich scenes . More about CZML Check out the links
var dataSource = Cesium.CzmlDataSource.load("/static/data/Vehicle.czml");

边栏推荐
- Locust performance test 4 (custom load Policy)
- With an annual salary of 50W, Alibaba P8 will come out in person to teach you how to advance from testing
- Platformization, a fulcrum of strong chain complementing chain
- Goldbach conjecture C language
- Interpretation of MySQL optimization principle
- Led analog and digital dimming
- C语言指针(特别篇)
- Selenium mouse sliding operation event
- PMP certificate preparation experience sharing
- MySQL主从延迟的解决方案
猜你喜欢

Serial port experiment - simple data sending and receiving

Several stages of PMP preparation study

C language pointer (Part 2)

C language pointer (Part 1)

Ppt template and material download website (pure dry goods, recommended Collection)

外部中断实现按键实验

Common short chain design methods

【istio简介、架构、组件】

2022-06-30 unity core 8 - model import

C language pointer (Part 2)
随机推荐
Vagrant failed to mount directory mount: unknown filesystem type 'vboxsf'
What is the value of getting a PMP certificate?
Recommended by Alibaba P8, the test coverage tool - Jacobo is very practical
C语言指针(特别篇)
Un salaire annuel de 50 W Ali P8 vous montrera comment passer du test
Upgrade Alibaba cloud RDS (relational database service) instance to com mysql. jdbc. exceptions. Troubleshooting of jdbc4.communicationsexception
年薪50w阿裏P8親自下場,教你如何從測試進階
Selenium automation integration, eight years of testing experience, soft test engineer, an article to teach you
Count the number of words in the string c language
Several methods of calculating the average value of two numbers
C语言指针(下篇)
Problems encountered in the use of go micro
【ChaosBlade:节点磁盘填充、杀节点上指定进程、挂起节点上指定进程】
Digital triangle model acwing 1027 Grid access
Platformization, a fulcrum of strong chain complementing chain
Systick滴答定时器
Interpretation of MySQL optimization principle
Markdown editor Use of MD plug-in
PMP Exam details after the release of the new exam outline
How to use Arthas to view class variable values