Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public static LineString coorConvertPath(List<CoordinateDto> path) {
try {
return getLineString(path);
} catch (Exception e) {
log.warn("course 요청 데이터 값 (path) -> " + path);
log.warn("course 요청 데이터 값의 타입 (path) -> " + path.getClass().getName());
log.warn("course 요청 데이터 변환 실패 (size={}, type={}): {}", path.size(), path.getClass().getName(), e.getMessage());
throw new BadRequestException(ErrorStatus.VALIDATION_COURSE_PATH_EXCEPTION, ErrorStatus.VALIDATION_COURSE_PATH_EXCEPTION.getMessage());
}
}
Expand All @@ -43,16 +42,11 @@ public static List<List<Double>> pathConvertCoor(LineString path) {
}

private static LineString getLineString(List<CoordinateDto> coordinateDtos) {
StringBuilder sb = new StringBuilder();
GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326);
Coordinate[] coordinates = new Coordinate[coordinateDtos.size()];
for (int i = 0; i < coordinateDtos.size(); i++) {
coordinates[i] = new Coordinate(coordinateDtos.get(i).getLatitude(), coordinateDtos.get(i).getLongitude());
sb.append("(" + coordinateDtos.get(i).getLatitude() + ", " + coordinateDtos.get(i).getLongitude() + ")");
}
LineString lineString = geometryFactory.createLineString(coordinates);
log.info("create course!");
log.info(sb.toString());
return lineString;
return geometryFactory.createLineString(coordinates);
}
}
Loading