wmts, wms url 추가

This commit is contained in:
2026-01-30 19:40:41 +09:00
parent 302e1ad957
commit 0993ce646a
3 changed files with 46 additions and 16 deletions

View File

@@ -17,6 +17,7 @@ import com.kamco.cd.kamcoback.postgres.core.MapLayerCoreService;
import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -30,6 +31,12 @@ public class LayerService {
private final WmtsService wmtsService;
private final WmsService wmsService;
@Value("${layer.geoserver-url}")
private String geoserverUrl;
@Value("${layer.path}")
private String geoserverPath;
/**
* 지도 레이어 관리 목록
*
@@ -175,7 +182,26 @@ public class LayerService {
}
public List<LayerMapDto> findLayerMapList(String type) {
return mapLayerCoreService.findLayerMapList(type);
List<LayerMapDto> layerMapDtoList = mapLayerCoreService.findLayerMapList(type);
layerMapDtoList.forEach(
dto -> {
if (dto.getLayerType().equals("WMS") || dto.getLayerType().equals("WMTS")) {
dto.setUrl(
String.format(
"%s/%s/%s",
trimSlash(geoserverUrl),
trimSlash(geoserverPath),
dto.getLayerType().toLowerCase()));
}
});
return layerMapDtoList;
}
private String trimSlash(String s) {
if (s == null) {
return "";
}
return s.replaceAll("/+$", "").replaceAll("^/+", "");
}
public LayerDto.YearTileDto getChangeDetectionTileUrl(Integer beforeYear, Integer afterYear) {