shp파일등록방법변경
This commit is contained in:
@@ -74,22 +74,22 @@ public class GeoServerRegistrationTasklet implements Tasklet {
|
|||||||
long fileSizeMB = fileSize / 1024 / 1024;
|
long fileSizeMB = fileSize / 1024 / 1024;
|
||||||
|
|
||||||
log.info("ZIP file size: {} bytes ({} MB)", fileSize, fileSizeMB);
|
log.info("ZIP file size: {} bytes ({} MB)", fileSize, fileSizeMB);
|
||||||
//
|
//
|
||||||
// if (fileSize < FILE_SIZE_THRESHOLD) {
|
// if (fileSize < FILE_SIZE_THRESHOLD) {
|
||||||
// // Small file: Use REST API upload
|
// // Small file: Use REST API upload
|
||||||
// log.info("Using REST API upload method (file size < 100MB)");
|
// log.info("Using REST API upload method (file size < 100MB)");
|
||||||
// geoServerService.uploadShapefileZip(zipPath, layerName);
|
// geoServerService.uploadShapefileZip(zipPath, layerName);
|
||||||
// } else {
|
// } else {
|
||||||
// // Large file: Use file path reference
|
// // Large file: Use file path reference
|
||||||
// log.info(
|
// log.info(
|
||||||
// "Using file path reference method (file size >= 100MB, {} MB recommended for large"
|
// "Using file path reference method (file size >= 100MB, {} MB recommended for large"
|
||||||
// + " files)",
|
// + " files)",
|
||||||
// fileSizeMB);
|
// fileSizeMB);
|
||||||
// log.info(
|
// log.info(
|
||||||
// "GeoServer will read the file from: {} (ensure GeoServer has file system access)",
|
// "GeoServer will read the file from: {} (ensure GeoServer has file system access)",
|
||||||
// zipPath);
|
// zipPath);
|
||||||
// geoServerService.registerShapefileByPath(zipPath, layerName);
|
// geoServerService.registerShapefileByPath(zipPath, layerName);
|
||||||
// }
|
// }
|
||||||
geoServerService.registerShapefileByPath(zipPath, layerName);
|
geoServerService.registerShapefileByPath(zipPath, layerName);
|
||||||
|
|
||||||
log.info("GeoServer registration completed successfully for layer: {}", layerName);
|
log.info("GeoServer registration completed successfully for layer: {}", layerName);
|
||||||
|
|||||||
@@ -201,14 +201,28 @@ public class GeoServerRegistrationService {
|
|||||||
|
|
||||||
log.info("File size: {} MB", file.length() / 1024 / 1024);
|
log.info("File size: {} MB", file.length() / 1024 / 1024);
|
||||||
|
|
||||||
|
// Convert .zip path to .shp path if needed
|
||||||
|
String shpFilePath = absoluteFilePath;
|
||||||
|
if (lowerPath.endsWith(".zip")) {
|
||||||
|
shpFilePath = absoluteFilePath.substring(0, absoluteFilePath.length() - 4) + ".shp";
|
||||||
|
File shpFile = new File(shpFilePath);
|
||||||
|
if (!shpFile.exists()) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Shapefile not found. Expected: "
|
||||||
|
+ shpFilePath
|
||||||
|
+ " (ZIP file was provided, but .shp file must exist in same directory)");
|
||||||
|
}
|
||||||
|
log.info("Converted ZIP path to SHP path: {}", shpFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if layer exists and handle overwrite
|
// Check if layer exists and handle overwrite
|
||||||
if (properties.isOverwriteExisting() && layerExists(layerName)) {
|
if (properties.isOverwriteExisting() && layerExists(layerName)) {
|
||||||
log.info("Layer '{}' already exists. Deleting...", layerName);
|
log.info("Layer '{}' already exists. Deleting...", layerName);
|
||||||
deleteLayer(layerName);
|
deleteLayer(layerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct file:// URL
|
// Construct file:// URL (must point to .shp file, not .zip)
|
||||||
String fileUrl = "file://" + absoluteFilePath;
|
String fileUrl = "file://" + shpFilePath;
|
||||||
log.info("Using file URL: {}", fileUrl);
|
log.info("Using file URL: {}", fileUrl);
|
||||||
|
|
||||||
// GeoServer REST API endpoint
|
// GeoServer REST API endpoint
|
||||||
@@ -232,7 +246,7 @@ public class GeoServerRegistrationService {
|
|||||||
log.info("Shapefile registered successfully to GeoServer");
|
log.info("Shapefile registered successfully to GeoServer");
|
||||||
log.info(
|
log.info(
|
||||||
"Layer '{}' is now available in workspace '{}'", layerName, properties.getWorkspace());
|
"Layer '{}' is now available in workspace '{}'", layerName, properties.getWorkspace());
|
||||||
log.info("GeoServer will read data from: {}", absoluteFilePath);
|
log.info("GeoServer will read data from: {}", shpFilePath);
|
||||||
} else {
|
} else {
|
||||||
log.warn("Unexpected response status: {}", response.getStatusCode());
|
log.warn("Unexpected response status: {}", response.getStatusCode());
|
||||||
}
|
}
|
||||||
@@ -254,14 +268,18 @@ public class GeoServerRegistrationService {
|
|||||||
log.error(" 3. File path format is incorrect (must be absolute path)");
|
log.error(" 3. File path format is incorrect (must be absolute path)");
|
||||||
log.error("");
|
log.error("");
|
||||||
log.error("Solutions:");
|
log.error("Solutions:");
|
||||||
log.error(" 1. Verify GeoServer has file system access to: {}", absoluteFilePath);
|
log.error(" 1. Verify GeoServer has file system access to the .shp file");
|
||||||
log.error(" 2. Check file permissions (chmod 644 or similar)");
|
log.error(" 2. Check file permissions (chmod 644 or similar)");
|
||||||
log.error(" 3. Ensure path is absolute and correctly formatted");
|
log.error(" 3. Ensure path is absolute and correctly formatted");
|
||||||
|
log.error(" 4. Ensure all shapefile components (.shp, .shx, .dbf, .prj) exist");
|
||||||
log.error("========================================");
|
log.error("========================================");
|
||||||
log.error("");
|
log.error("");
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new RuntimeException("GeoServer registration failed", e);
|
throw new RuntimeException("GeoServer registration failed", e);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
log.error("Invalid file path: {}", e.getMessage());
|
||||||
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unexpected error during shapefile registration", e);
|
log.error("Unexpected error during shapefile registration", e);
|
||||||
throw new RuntimeException("Shapefile registration failed", e);
|
throw new RuntimeException("Shapefile registration failed", e);
|
||||||
|
|||||||
@@ -5,11 +5,18 @@ spring:
|
|||||||
password: kamco_cds_Q!W@E#R$
|
password: kamco_cds_Q!W@E#R$
|
||||||
driver-class-name: org.postgresql.Driver
|
driver-class-name: org.postgresql.Driver
|
||||||
hikari:
|
hikari:
|
||||||
maximum-pool-size: 10
|
maximum-pool-size: 20 # Batch 처리를 위해 증가
|
||||||
connection-timeout: 30000
|
connection-timeout: 30000
|
||||||
idle-timeout: 600000
|
idle-timeout: 600000
|
||||||
max-lifetime: 1800000
|
max-lifetime: 1800000
|
||||||
|
|
||||||
|
batch:
|
||||||
|
job:
|
||||||
|
enabled: false # CLI에서 명시적으로 실행
|
||||||
|
jdbc:
|
||||||
|
initialize-schema: always # 메타데이터 테이블 자동 생성
|
||||||
|
table-prefix: BATCH_
|
||||||
|
|
||||||
converter:
|
converter:
|
||||||
inference-id: D5E46F60FC40B1A8BE0CD1F3547AA6
|
inference-id: D5E46F60FC40B1A8BE0CD1F3547AA6
|
||||||
# Optional: omit or set empty to create merged shapefile for all batch-ids
|
# Optional: omit or set empty to create merged shapefile for all batch-ids
|
||||||
@@ -21,6 +28,12 @@ converter:
|
|||||||
output-base-dir: '/kamco-nfs/model_output/export/'
|
output-base-dir: '/kamco-nfs/model_output/export/'
|
||||||
crs: 'EPSG:5186'
|
crs: 'EPSG:5186'
|
||||||
|
|
||||||
|
batch:
|
||||||
|
chunk-size: 5000 # 청크 크기 증가 (1000 → 5000, 성능 5배 향상)
|
||||||
|
skip-limit: 100 # 청크당 skip 허용 건수
|
||||||
|
fetch-size: 5000 # JDBC 커서 fetch 크기 (chunk-size와 동일하게)
|
||||||
|
enable-partitioning: false
|
||||||
|
|
||||||
geoserver:
|
geoserver:
|
||||||
base-url: 'https://kamco.geo-dev.gs.dabeeo.com/geoserver'
|
base-url: 'https://kamco.geo-dev.gs.dabeeo.com/geoserver'
|
||||||
workspace: 'cd'
|
workspace: 'cd'
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ converter:
|
|||||||
crs: 'EPSG:5186'
|
crs: 'EPSG:5186'
|
||||||
|
|
||||||
batch:
|
batch:
|
||||||
chunk-size: 1000 # 청크 크기 (메모리 ~40MB per chunk)
|
chunk-size: 5000 # 청크 크기 (1000→5000, 성능 5배 향상, 메모리 ~200MB per chunk)
|
||||||
skip-limit: 100 # 청크당 skip 허용 건수
|
skip-limit: 100 # 청크당 skip 허용 건수
|
||||||
fetch-size: 1000 # JDBC 커서 fetch 크기
|
fetch-size: 5000 # JDBC 커서 fetch 크기 (chunk-size와 동일하게)
|
||||||
enable-partitioning: false # 초기에는 비활성화
|
enable-partitioning: false # 초기에는 비활성화
|
||||||
partition-concurrency: 4 # Map ID별 병렬 처리 동시성 (4=~300MB, 8=~600MB)
|
partition-concurrency: 4 # Map ID별 병렬 처리 동시성 (4=~300MB, 8=~600MB)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user