๋ฌธ์ ์์ฝ

GeojsonDataSource.load()๋ก ๋ฐ์ดํฐ๋ฅผ ๋ถ๋ฌ์ polygon๊ณผ ๊ทธ ๊ฒฝ๊ณ์ ์ ๊ทธ๋ฆฌ๋ ค๊ณ ํ๋ค.
1. 3D ์งํ ์์ ๊ฒฝ๊ณ์ ์ ๊ทธ๋ ค์ผ ํจ
2. ๊ฒฝ๊ณ์ ์ด ๊ฐ๋ ์ฌ๋ผ์ง๋ ์ค๋ฅ๊ฐ ์์
ํด๊ฒฐ ์์ฝ
1. Polygon์ ๊ทธ๋ฆฐ ๋ค, ๊ทธ ์์ Polyline ํ์
์ผ๋ก ๊ฒฝ๊ณ์ ์ ๊ทธ๋ ค์ค๋ค.
2. Polyline(๊ฒฝ๊ณ์ )์ด ํญ์ ์นด๋ฉ๋ผ์ ๊ฐ๊น๋๋ก zIndex๋ฅผ ์ค์ ํ๋ค.
์์ธ ์ค๋ช
1. 3D ์งํ์ ๋ถ์ฐฉ ๊ฐ๋ฅํ ๋ฉด๊ณผ ์ ๊ทธ๋ฆฌ๊ธฐ
1
2
3
4
5
6
7
8
9
10
11
|
viewer.dataSources.add(
Cesium.GeoJsonDataSource.load(
"../SampleData/ne_10m_us_states.topojson",
{
stroke: Cesium.Color.HOTPINK,
fill: Cesium.Color.PINK.withAlpha(0.5),
strokeWidth: 3,
//clampToGround: true
}
)
);
|
cs |
GeojsonDataSource.load()๋ก ๋ฐ์ดํฐ๋ฅผ ๋ถ๋ฌ์ฌ ๊ฒฝ์ฐ, ๋ด๋ถ ์์๊ณผ ๊ฒฝ๊ณ์ ์ ์ง์ ํ ์ ์๋ค.
ํ์ง๋ง ๋ฐ์ดํฐ๋ฅผ 3D ์งํ ์์ ๋ถ์ฐฉํ๊ฒ ๋๋ฉด ์ด๋ฐ ์ต์ ์ ์ฌ์ฉํ ์ ์๋ค. ๋ฐ์ดํฐ๋ฅผ 3D ์งํ ์์ ๋ฌ๋ผ๋ถ๊ฒ ํ๋ ์ต์ ์ธ clampToGround๋ฅผ ์ฌ์ฉ(true)ํ ๊ฒฝ์ฐ, stroke ์ต์ ์ ์ฌ์ฉํ ์ ์๋ ํ์์ ๊ด๋ จ๋ ๊นํ๋ธ ์ด์ ์ฐธ๊ณ .
๊ทธ๋์ polygonํ์ ๊ณผ polylineํ์ ์ entity๋ฅผ ๊ฐ๊ฐ ์ถ๊ฐํด ์ฃผ์๋ค. json์ DataSource ํ์ ์ผ๋ก ๋ก๋ํ๊ณ , ์์ฑ์ ๊ทธ๋๋ก entity ์์ฑ option์ ๋ฃ์ด์ค๋ค.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
GeoJsonDataSource.load( "../SampleData/ne_10m_us_states.topojson")
.then(dataSource => { dataSource.entities.values.forEach(element => {
const entity = viewer.entities.add({
polygon: {
hierarchy: element.polygon.hierarchy.getValue(),
material: Cesium.Color.PINK.withAlpha(0.5),
},
polyline: {
positions: element.polygon.hierarchy.getValue().positions,
width: 2,
material: Cesium.Color.PINK.withAlpha(0.5),
clampToGround: true,
},
properties: element.properties,
})
}
|
cs |
2. ์ ์ด ์ฌ๋ผ์ง๋ ๋ฌธ์

์ ๋ก๋ํ ๋ฐ์ดํฐ๊ฐ ์๊ฐ๋ณด๋ค ์ต์ ํํ๊ธฐ ์ด๋ ค์ ๋์ง, ๋ณํ ๊ณผ์ ์์ entity๊ฐ ์๋ง์ผ๋ก ์์ฑ๋์๊ฑฐ๋ ๋ ๋๋ง์ ์ต์ ํ๋์ง ๋ชปํ ๊ฒ ๋ง๋ฅ ์์ค๋ฅ๊ฐ ๋ฐ์ํ๋ค. ์์ธ์ ๋ชจ๋ฅด๊ฒ ์ง๋ง ์ํธ์์ฉํ ๋๋ง๋ค polyline์ผ๋ก ๋ง๋ ๊ฒฝ๊ณ์ ์ด ํฌ๋ฏธํด์ก๋ค. ์ค๋ฅ ๋ฉ์์ง๋ ์๊ณ ๊ฒฝ๊ณ์ ๋ถ๋ถ์ ํด๋ฆญํ๋ฉด ๋ค์ ์ ์ด ๋๋ ทํ๊ฒ ๋ณด์ธ๋ค. ์์ ์ฌ๋ผ์ง๋ ๋ฌธ์ ๋ ์๋๊ณ , polygon๊ณผ polyline์ด ์นด๋ฉ๋ผ ๋ฐฉํฅ์์ ์์น๋ฝ๋ค์น๋ฝํ๋ ๊ฒ ๊ฐ๋ค.

์นด๋ฉ๋ผ์ ๋๊ฐ ๋ ๊ฐ๊น๊ฒ ๋ณด์ด๋์ง ์์๋ฅผ ์ ํด์, ๊ฐ๋ ค์ง๋ ๋ ์์ ์ง์ ํด์ฃผ๊ธฐ๋ก ํ๋ค. ํต์์ ์ผ๋ก Z-Index์์ ์์ ์ ๋ฆฌ๋ผ๊ณ ํํํ๋ ๋ณด๋ค. ๋ค๋ฅธ 3D ๊ฐ๋ฐ์ ํ ๋์๋ ๊ฐ์ ์ฉ์ด๋ฅผ ์ผ๋ ๊ฒ ๊ฐ๋ค. ์ด๋ฆ์ ๊ฐ์๋ ๋ํ ์ผํ ๋ถ๋ถ์์ ๋ค๋ฅผ ์ ์์ผ๋ฏ๋ก ์ฌ์ฉํ๋ ๊ฐ๋ฐ ํ๊ฒฝ์ด๋ ์์ง์ ๋ฐ๋ผ ์ฉ๋ฒ์ ์ฐพ์๋ด์ผ ํ๋ค. (๊ทธ๋๋ ๊ฑฐ์ ๋น์ทํ๊ธด ํจ) CesiumJS Forum์ Z-Index ์ง์๊ธ ์ฐธ๊ณ
Polyline์ด ๊ฐ๋ ค์ง๋ ๊ฒ์ด ๋ฌธ์ ์ด๋ฏ๋ก, Polyline์ Z-Index ๊ฐ์ ํฌ๊ฒ ํด์ ์นด๋ฉ๋ผ์ ๊ฐ์ฅ ๊ฐ๊น๊ฒ ์์นํ๋๋ก ํ๋ค.
1
2
3
4
5
6
7
8
|
polyline: {
positions: element.polygon.hierarchy.getValue().positions,
width: 2,
material: Cesium.Color.PINK.withAlpha(0.5),
clampToGround: true,
zIndex: 10 // ํด์๋ก ์นด๋ฉ๋ผ์ ๊ฐ๊น๋ค
}
|
cs |
3. ์ผ๋จ ํด๊ฒฐ
์ฌ๋ฌ ๋ฒ ํด๋ฆญํด๋ ์ ์ด ์ง์์ง์ง ์๊ณ ์ ๋ณด์

'๐ ํ์ต๊ณผ ๊ฐ๋ฐ ๊ธฐ๋ก > GIS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
CesiumJS (0) | 2022.02.03 |
---|---|
ํ์ค๋ ธ๋๋งํฌ ์ปฌ๋ผ ๋ถ์ (0) | 2022.01.12 |
QGIS๋ฅผ ์ฌ์ฉํ์ฌ, ์ขํ๊ณ ์ ๋ณด๋ฅผ ํฌํจํ ๋ฐ์ดํฐ ๋ด๋ณด๋ด๊ธฐ (0) | 2022.01.07 |
[GIS] GeoCoding (0) | 2021.08.31 |
[GIS] ์ฃผ์ ์ขํ๊ณ (0) | 2021.08.12 |