라벨링툴 상세 geom 리턴 형식 수정
This commit is contained in:
@@ -14,9 +14,13 @@ import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.ChangeDetect
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.ClassificationInfo;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.DetailRes;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.GeoFeatureRequest.Properties;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceDataGeometry;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InferenceDataGeometry.InferenceProperties;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.InspectionResultInfo;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingGeometryInfo;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LabelingListDto;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LearnDataGeometry;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.LearnDataGeometry.LearnProperties;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.SummaryRes;
|
||||
import com.kamco.cd.kamcoback.trainingdata.dto.TrainingDataLabelDto.searchReq;
|
||||
import com.querydsl.core.types.Projections;
|
||||
@@ -456,29 +460,23 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
||||
.build();
|
||||
|
||||
// 6. Geometry를 GeoJSON으로 변환
|
||||
JsonNode geomJson = null;
|
||||
if (mapSheetAnalDataInferenceGeomEntityEntity.getGeom() != null) {
|
||||
try {
|
||||
String geomString =
|
||||
queryFactory
|
||||
.select(
|
||||
InferenceDataGeometry inferData =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
InferenceDataGeometry.class,
|
||||
Expressions.stringTemplate("{0}", "Feature"),
|
||||
Expressions.stringTemplate(
|
||||
"ST_AsGeoJSON({0})", mapSheetAnalDataInferenceGeomEntity.geom))
|
||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||
.where(
|
||||
mapSheetAnalDataInferenceGeomEntity.geoUid.eq(
|
||||
mapSheetAnalDataInferenceGeomEntityEntity.getGeoUid()))
|
||||
.fetchOne();
|
||||
|
||||
if (geomString != null) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
geomJson = mapper.readTree(geomString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("GeoJSON parsing error: " + e.getMessage());
|
||||
// JSON 파싱 실패 시 null 유지
|
||||
}
|
||||
}
|
||||
"ST_AsGeoJSON({0})", mapSheetAnalDataInferenceGeomEntity.geom),
|
||||
Projections.constructor(
|
||||
InferenceProperties.class,
|
||||
mapSheetAnalDataInferenceGeomEntity.classBeforeCd,
|
||||
mapSheetAnalDataInferenceGeomEntity.classAfterCd)))
|
||||
.from(mapSheetAnalDataInferenceGeomEntity)
|
||||
.where(
|
||||
mapSheetAnalDataInferenceGeomEntity.geoUid.eq(
|
||||
mapSheetAnalDataInferenceGeomEntityEntity.getGeoUid()))
|
||||
.fetchOne();
|
||||
|
||||
// 도엽 bbox json으로 가져오기
|
||||
JsonNode mapBbox = null;
|
||||
@@ -500,37 +498,33 @@ public class TrainingDataLabelRepositoryImpl extends QuerydslRepositorySupport
|
||||
}
|
||||
|
||||
// 7. 라벨링 저장한 Geometry를 GeoJSON으로 변환
|
||||
JsonNode learnJson = null;
|
||||
try {
|
||||
String learnString =
|
||||
queryFactory
|
||||
.select(
|
||||
Expressions.stringTemplate(
|
||||
"ST_AsGeoJSON({0})", mapSheetLearnDataGeomEntity.geom))
|
||||
.from(mapSheetLearnDataGeomEntity)
|
||||
.where(
|
||||
mapSheetLearnDataGeomEntity.geoUid.eq(
|
||||
mapSheetAnalDataInferenceGeomEntityEntity.getGeoUid()))
|
||||
.fetchOne();
|
||||
|
||||
if (learnString != null) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
learnJson = mapper.readTree(learnString);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("learnJson parsing error: " + e.getMessage());
|
||||
// JSON 파싱 실패 시 null 유지
|
||||
}
|
||||
LearnDataGeometry learnData =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
LearnDataGeometry.class,
|
||||
Expressions.stringTemplate("{0}", "Feature"),
|
||||
Expressions.stringTemplate(
|
||||
"ST_AsGeoJSON({0})", mapSheetLearnDataGeomEntity.geom),
|
||||
Projections.constructor(
|
||||
LearnProperties.class,
|
||||
mapSheetLearnDataGeomEntity.classBeforeCd,
|
||||
mapSheetLearnDataGeomEntity.classAfterCd)))
|
||||
.from(mapSheetLearnDataGeomEntity)
|
||||
.where(
|
||||
mapSheetLearnDataGeomEntity.geoUid.eq(
|
||||
mapSheetAnalDataInferenceGeomEntityEntity.getGeoUid()))
|
||||
.fetchOne();
|
||||
|
||||
return DetailRes.builder()
|
||||
.assignmentUid(assignmentUid)
|
||||
.changeDetectionInfo(changeDetectionInfo)
|
||||
.inspectionResultInfo(inspectionResultInfo)
|
||||
.geom(geomJson)
|
||||
.geom(inferData)
|
||||
.beforeCogUrl(beforeCogUrl)
|
||||
.afterCogUrl(afterCogUrl)
|
||||
.mapBox(mapBbox)
|
||||
.learnGeometry(learnJson)
|
||||
.learnGeometry(learnData)
|
||||
.build();
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user