月球大数据地理空间分析展示平台-【后端】-月球后台服务
1
13693261870
2024-11-17 796b44ea813a1133beae4f3a67f1c0263510c0c7
src/main/java/com/moon/server/service/data/SlopeAnalysisService.java
@@ -15,14 +15,11 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.*;
/**
 * 栅格分析服务
 * @author WWW
 * @date 2023-11-16
 */
@Service
@SuppressWarnings("ALL")
public class SlopeAnalysisService {
    @Value("${sys.path.slopFile}")
    private String filePath;
@@ -34,20 +31,14 @@
    private final static Log log = LogFactory.getLog(SlopeAnalysisService.class);
    /**
     * 获取Excel模板
     */
    private String getXlsTemplate() {
    private String getXlsTemplate() throws IOException {
        if (null == xlsTemplate) {
            xlsTemplate = FileHelper.getClassPath() + "config/slope.xlsx";
            xlsTemplate = FileHelper.getClassPathForWar() + File.separator + "config" + File.separator + "slope.xlsx";
        }
        return xlsTemplate;
    }
    /**
     * 下载坡度分析Excel
     */
    public void downloadSlopXls(Geometry polygon, HttpServletResponse res) throws Exception {
        Dataset ds = null;
        try {
@@ -75,9 +66,6 @@
        }
    }
    /**
     * 分析多边形
     */
    public List<PointEntity> analysisPolygon(Geometry geo, Dataset ds) {
        double[] transform = ds.GetGeoTransform();
        int xSize = ds.getRasterXSize(), ySize = ds.getRasterYSize();
@@ -113,9 +101,6 @@
        return list;
    }
    /**
     * 创建Excel
     */
    public String createXls(List<PointEntity> list, String template) {
        String target = pathHelper.getTempPath() + File.separator + "slope_" + StringHelper.YMD2_FORMAT.format(new Date()) + ".xlsx";