File
Typedefs
- prepareProc :
function
prepare 프로시져
- transferProc :
function
transfer 프로시져
- CadImporter :
*
CAD 임포터
- createCadImporter ⇒
Promise.<CadImporter>
새로운 CAD 파일을 업로드하기 위한 임포터를 반환한다.
- addGeoTiffLayer ⇒
Promise.<Array.<ol.Layer>>
GeoTIFF 레이어를 추가한다.
- addGeoTiffGLLayer ⇒
Promise.<Array.<ol.Layer>>
GeoTIFF GL가속 레이어를 추가한다.
prepareProc : function
prepare 프로시져
Kind: global typedef
Param | Type | Description |
---|---|---|
options | * | 옵션 |
transferProc : function
transfer 프로시져
Kind: global typedef
Param | Type | Description |
---|---|---|
options | * | 옵션 |
CadImporter : *
CAD 임포터
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
collections | * | 피쳐 콜랙션 배열 |
prepare | prepareProc | 임포트 헬퍼 |
transfer | transferProc | 임포트 헬퍼 |
createCadImporter ⇒ Promise.<CadImporter>
새로운 CAD 파일을 업로드하기 위한 임포터를 반환한다.
Kind: global typedef
Returns: Promise.<CadImporter>
- CAD 임포터
Param | Type | Default | Description |
---|---|---|---|
targets | File | Buffer | ArrayBuffer | ||
options | * | 옵션 | |
[options.filenames] | Array.<string> | 업로드 파일명 | |
options.from | string | 원본 형식 | |
[options.to] | string | “‘fgb‘“ | 반환 형식 ‘json’ 형식은 GeoJSON 형식으로 반환한다. ‘fgb’ 형식은 FlatGeobuf 형식으로 반환한다. 현재 기본 값은 ‘fgb’이다. ‘json’ 형식은 응답 데이터의 크기가 크고, 브라우저 JSON 파서에서 오류가 발생할 수 있으므로 현재 지원하지 않는다. |
options.browser | boolean | 서버 응답 방식 | |
options.url | string | 변환 서버 URL |
addGeoTiffLayer ⇒ Promise.<Array.<ol.Layer>>
GeoTIFF 레이어를 추가한다.
Kind: global typedef
Returns: Promise.<Array.<ol.Layer>>
- 생성된 ol.layer, 동일한 이름의 레이어가 있다면 해당 레이어를 반환한다. 레이어를 생성할 수 없으면 null 리턴
Param | Type |
---|---|
layerName | string |
options | LayerOption |
Example
LayerOption {
domain: {Array<number,2>} 값 최대 범위,
thresholds: {Array<number>} 값 구간,
interpolate: {boolean} 보간여부 (기본값=true)
alphaValue: {number} (0~1), 투명도값
callback: {function(x, y, value)} x, y는 Map 좌표, value : 마우스 커서 위치의 값, 값이 없을 때는 null
sources: {Array<string>} GeoTiff source url
useWebGL: {boolean} webGL 사용여부, default:true
}
case 1) geotiff pixel이 연속된 값이고, 범위에 따라 색상을 달리 표시하고자 할 때
const pathloss_option = {
domain: [0, 200],
interpolate: true,
alphaValue: 0.7,
colorScale: {
thresholds: [0, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 130, 140, 150, 160],
colorsDefs: [
'#0d0d73',
'#0000c0',
'#0000ff',
'#4040ff',
'#4080ff',
'#8080ff',
'#99ccff',
'#ccffff',
'#ccffcc',
'#ffff99',
'#ffff00',
'#ffcc99',
'#ff8000',
'#ff4000',
'#ff0000',
'#b81414',
],
},
sources: ['./samples/pathloss.tiff', './samples/pathloss_no_display.tiff'],
onPointerMove: value_callback,
};
case 2) geotiff pixel이 개별 값이고, 각 값별로 색상을 달리 표시하고자 할 때
이 예제에서는 값이 [0, 1, ..., 249] 있다고 가정하고, 각 값 별로 난수의 색상을 생성해준다.
const bastserver_option = {
domain: [0, 255],
interpolate: false,
alphaValue: 0.7,
sources: ['./samples/bestserver.tiff'],
onPointerMove: value_callback,
};
for (let i = 0; i < 256; i++) {
let r = parseInt(Math.random() * 256);
let g = parseInt(Math.random() * 256);
let b = parseInt(Math.random() * 256);
bastserver_option.thresholds.push(i);
bastserver_option.colorsDefs.push([r, g, b]);
}
사용법)
function value_callback(x, y, value) {
console.log("VALUE", x, y, value);
}
const pathloss_option = {
domain: [0, 200],
interpolate: true,
alphaValue: 0.7,
colorScale: {
thresholds: [0, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115, 120, 130, 140, 150, 160],
colorsDefs: [
'#0d0d73',
'#0000c0',
'#0000ff',
'#4040ff',
'#4080ff',
'#8080ff',
'#99ccff',
'#ccffff',
'#ccffcc',
'#ffff99',
'#ffff00',
'#ffcc99',
'#ff8000',
'#ff4000',
'#ff0000',
'#b81414',
],
},
sources: ['https://s3.ap-northeast-2.amazonaws.com/mybucket/pathloss.tiff'],
onPointerMove: value_callback,
};
const bastserver_option = {
domain: [0, 255],
interpolate: false,
alphaValue: 0.7,
sources: ['https://s3.ap-northeast-2.amazonaws.com/mybucket/bestserver_grid1.tiff', 'https://s3.ap-northeast-2.amazonaws.com/mybucket/bestserver_grid2.tiff',],
onPointerMove: value_callback,
};
for (let i = 0; i < 256; i++) {
let r = parseInt(Math.random() * 256);
let g = parseInt(Math.random() * 256);
let b = parseInt(Math.random() * 256);
bastserver_option.thresholds.push(i);
bastserver_option.colorsDefs.push([r, g, b]);
}
let pathlossLayer = null;
let bestserverLayer = null;
gwsJS.file.addGeoTiffLayer("PATHLOSS", pathloss_option).then(layer => { pathlossLayer = layer });
gwsJS.file.addGeoTiffLayer("BESTSERVER", bastserver_option).then(layer => { bestserverLayer = layer });
레이어 켜고/끄기)
let isVisible = pathlossLayer.getVisible();
pathlossLayer.setVisible(isVisible ? false : false); // toggle
화면에 표시된 분석결과 데이터 얻기
// 분석결과 저장하는 부분 구현
let layer = gwsJS.getCustomLayer("PATHLOSS");
let func = layer.get("getSource");
let source = [];
for (let s of func()) {
let line = []
for (let h = 0; h < s.height; h++) {
let t = [];
let a = s.data.slice(h * s.width, (h + 1) * s.width);
for (let w = 0; w < s.width; w++) {
t.push(a[w] === s.nodata ? '' : a[w].toString());
}
line.push(t.join(','));
}
let d = { width: s.width, height: s.height, value: line }
source.push(d);
}
let json = JSON.stringify(source);
var blob = new Blob([json], {
type: 'octet/stream'
});
var anchor = document.createElement('a')
anchor.download = 'result.txt';
anchor.href = window.URL.createObjectURL(blob);
anchor.click();
addGeoTiffGLLayer ⇒ Promise.<Array.<ol.Layer>>
GeoTIFF GL가속 레이어를 추가한다.
Kind: global typedef
Returns: Promise.<Array.<ol.Layer>>
- 생성된 ol.layer, 동일한 이름의 레이어가 있다면 해당 레이어를 반환한다. 레이어를 생성할 수 없으면 null 리턴
Param | Type |
---|---|
layerName | string |
options | LayerOption |