feat: gis.layer.js 최신화

This commit is contained in:
swcho
2025-08-06 20:59:56 +09:00
parent 6c0d65a69a
commit 395590bbe4
@@ -71,7 +71,7 @@ GisOlLayer.prototype = {
/**
* [사용]WFS 벡터 소스 반환
*/
getVectorSourceGeoserver: function (options) {
getVectorSourceBbox: function (options) {
let url = GisApp.GEOSERVER_URL;
let toProj = GisApp.TO_PROJ;
let lyrTyNm = options.lyrTyNm;
@@ -110,29 +110,27 @@ GisOlLayer.prototype = {
getVectorTileSource: function (options) {
let url = GisApp.GEOSERVER_URL;
let toProj = GisApp.TO_PROJ;
let lyrTyNm = options.lyrTyNm;
let typename = this.storageNm + lyrTyNm;
let filter = options?.flterSql && options.flterSql && options.flterSql.trim() !== ''
let params = {};
params['TYPENAME'] = this.storageNm + options.typeName;
params['TYPENAME'] = typename;
params['SERVICE'] = 'WFS';
params['VERSION'] = '1.1.0';
params['REQUEST'] = 'GetFeature';
params['SRS'] = toProj;
params['OUTPUTFORMAT'] = 'application/json';
if (filter) params['CQL_FILTER'] = filter;
let strParams = new URLSearchParams(params).toString();
let source = new VectorTile({
let source = new VectorSource({
format: new GeoJSON(),
tileUrlFunction: function (tileCoord, pixelRatio, projection) {
let filterStr = '&CQL_FILTER=bbox(GEOM,' + source.getTileGrid().getTileCoordExtent(tileCoord).join(',') + ",'" + projection.getCode() + "')";
if (options.flterSql) {
filterStr += ' AND ' + options.flterSql;
}
let paramWithUrl = url + '?' + strParams + filterStr;
return paramWithUrl;
url: function (extent) {
return url + '?' + strParams;
},
tileGrid: createXYZ,
strategy: all,
});
return source;
},
/**
@@ -142,19 +140,19 @@ GisOlLayer.prototype = {
option = option || {};
//레이어 생성
let returnLayer = this.makeLayer(option);
//레이어 소스 생성
let source;
let cmncNm = option.cmncNm;
let lyrTyNm = option.lyrTyNm;
if(lyrTyNm == 'tb_ms_flood_dngr_map'
|| lyrTyNm == 'tb_ms_sbmrg_dngr_map'
|| lyrTyNm == 'tb_ms_swage_mhl'
|| lyrTyNm == 'tb_ms_swage_ppl'
|| lyrTyNm == 'tb_ms_swage_pmstn'
) {
source = this.getVectorSourceBbox(option);
}else {
source = this.getVectorTileSource(option);
try {
if(cmncNm == 'bbox') {
source = this.getVectorSourceBbox(option);
}else {
source = this.getVectorTileSource(option);
}
}catch(error){
console.warn(option);
}
returnLayer.setSource(source);
@@ -567,6 +565,15 @@ GisOlLayer.prototype = {
cesiumScene.camera.moveEnd.addEventListener(cesiumScene._moveEndListener);
}
},
getFeatureById: function(featureId){
this.layers
.getArray()
.forEach(layer => {
const source = layer.getSource();
const feature = source.getFeatureById(String(featureId).trim());
if (feature) return feature;
});
}
};
function getOpenLayersZoom(cesiumScene) {