지도 레이어 추가

This commit is contained in:
yschoi
2025-07-07 16:58:53 +09:00
parent cbb41bb200
commit b7f345fdf7
4 changed files with 54 additions and 28 deletions
+2 -2
View File
@@ -9,6 +9,6 @@ NEXT_PUBLIC_AUTH_USER_ID = token-id
NEXT_PUBLIC_ACCESS_TOKEN = access-token
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
#NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
+39 -4
View File
@@ -6,6 +6,7 @@ const CLAIM_NAME = "Authorization";
const AUTH_USER_ID = "token-id";
const serverApiUrl = CS_URL;
const GEOSERVER_URL = process.env.NEXT_PUBLIC_GEOSERVER_URL || "";
const LX_GEOSERVER_URL = process.env.NEXT_PUBLIC_LX_GEOSERVER_URL || "";
const SEWERAGE_API_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
export function middleware(req: NextRequest) {
@@ -48,10 +49,44 @@ export function middleware(req: NextRequest) {
}
if (pathname.startsWith("/geoserver")) {
const queryParams = searchParams.toString();
const newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${
queryParams ? `?${queryParams}` : ""
}`;
let queryParams = searchParams.toString();
const typename = searchParams.get("TYPENAME");
console.log("typename ", typename);
let newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${queryParams ? `?${queryParams}` : ""}`;
if (
typename == "hasudo:tb_il_swage_prcs_fclt" //하수처리시설
|| typename == "hasudo:tb_ms_swage_prcs_zone" //하수처리구역
|| typename == "hasudo:tb_ms_sbmrg_dngr_map" //침수위험지도
|| typename == "hasudo:tb_ms_flood_dngr_map" //도시침수지도
) {
newUrl = `${GEOSERVER_URL}${pathname.replace("/geoserver", "")}${queryParams ? `?${queryParams}` : ""}`;
}
else if (
typename == "hasudo:tb_ms_swage_ppl" //관로
|| typename == "hasudo:tb_ms_swage_mhl" //맨홀
|| typename == "hasudo:tb_ms_swage_pmstn" //펌프장
|| typename == "hasudo:tb_ms_stofcbr" //우수토실
) {
newUrl = `${LX_GEOSERVER_URL}${pathname.replace("/geoserver", "")}${queryParams ? `?${queryParams}` : ""}`;
}
else if (
typename == "hasudo:om_dt_untrt_swg_rain" //중점우수토실
|| typename == "hasudo:om_wqlt_station" //관측소
|| typename == "hasudo:tb_wr_bdst_ruse_fclt" //재이용시설
|| typename == "hasudo:tb_wr_rnwtr_utztn_fclt" //빗물이용시설
|| typename == "hasudo:tb_wr_rswtr_fclt" //중수도시설
|| typename == "hasudo:tb_wr_htdfl_fclt" //온배수시설
|| typename == "hasudo:tb_wr_ruse_fclt_dmd_co" //수요처
|| typename == "hasudo:tb_wr_tmpr_dmd_co" //잠재수요처
){
const url = req.nextUrl.clone();
url.searchParams.set('TYPENAME', typename.replace("hasudo:",""));
queryParams = url.searchParams.toString();
newUrl = `${SEWERAGE_API_URL}/v1/map/geometry${queryParams ? `?${queryParams}` : ""}`;
}
console.log(`[Middleware] Rewriting from '/geoserver' path to: ${newUrl}`);
return NextResponse.rewrite(new URL(newUrl));
}
@@ -31,8 +31,6 @@ const GisApp = {};
//레이어 정보
GisApp.layerInfos = [];
//기본정보
//GisApp.GEOSERVER_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/ows';
//GisApp.GEOSERVER_WMS_URL = 'http://rsone.iptime.org:10010/geoserver/hasudo/wms';
GisApp.GEOSERVER_URL = '/geoserver/hasudo/ows';
GisApp.SN_GEOSERVER_URL = '/sewerage-service/api/v1/map/geometry';
GisApp.GEOSERVER_WMS_URL = '/geoserver/hasudo/wms';
@@ -56,7 +54,6 @@ GisApp.OPENSTREET_URL = '//tile.openstreetmap.org/{z}/{x}/{y}.png';
GisApp.BASE_MAP_TYPES = [];
GisApp.FROM_PROJ = 'EPSG:4326';
// GisApp.TO_PROJ = 'EPSG:3857';
GisApp.TO_PROJ = 'EPSG:5179'; //ngii 좌표계
GisApp.TO_DATA_PROJ = 'EPSG:4326';
GisApp.CONTEXT_LAYER_PATH = '/images/map/layericon/';
@@ -77,19 +77,6 @@ GisOlLayer.prototype = {
let lyrTyNm = options.lyrTyNm;
let typename = this.storageNm + lyrTyNm;
if(options.lyrTyNm == "om_dt_untrt_swg_rain" //중점우수토실
|| options.lyrTyNm == "om_wqlt_station" //관측소
|| options.lyrTyNm == "tb_wr_bdst_ruse_fclt" //재이용시설
|| options.lyrTyNm == "tb_wr_rnwtr_utztn_fclt" //빗물이용시설
|| options.lyrTyNm == "tb_wr_rswtr_fclt" //중수도시설
|| options.lyrTyNm == "tb_wr_htdfl_fclt" //온배수시설
|| options.lyrTyNm == "tb_wr_tmpr_dmd_co" //잠재수요처
)
{
url = GisApp.SN_GEOSERVER_URL;
typename = lyrTyNm;
}
const params = {};
params['TYPENAME'] = typename;
params['SERVICE'] = 'WFS';
@@ -97,16 +84,23 @@ GisOlLayer.prototype = {
params['REQUEST'] = 'GetFeature';
params['SRS'] = toProj;
params['OUTPUTFORMAT'] = 'application/json';
if (options?.flterSql && options?.flterSql?.trim() !== 'null') {
params['CQL_FILTER'] = options?.flterSql;
}
const strParams = new URLSearchParams(params).toString();
let source = new VectorSource({
format: new GeoJSON(),
url: function (extent) {
const [minX, minY, maxX, maxY] = extent;
const bboxFilter = `BBOX(geom, ${minX}, ${minY}, ${maxX}, ${maxY}, '${toProj}')`;
const filter = options?.flterSql && options.flterSql && options.flterSql.trim() !== ''
? `(${options.flterSql}) AND ${bboxFilter}`
: bboxFilter;
params['CQL_FILTER'] = filter;
const strParams = new URLSearchParams(params).toString();
return url + '?' + strParams;
},
strategy: all,
strategy: bbox,
});
return source;
},
@@ -212,7 +206,7 @@ GisOlLayer.prototype = {
return null;
}
let vectorSource = new VectorSource({
strategy: all,
strategy: bbox,
});
if (feature) {
if (Object.prototype.toString.call(feature).slice(8, -1).indexOf('Object') > -1) {