月球大数据地理空间分析展示平台-【后端】-月球后台服务
1
13693261870
2023-09-22 1fe2e7075d517249f6019396ec5f09427f3795e5
1
已修改1个文件
11 ■■■■ 文件已修改
src/main/java/com/moon/server/service/data/RasterAnalysisService.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/data/RasterAnalysisService.java
@@ -143,6 +143,7 @@
     */
    private void openRaster(AnalysisResultEntity entity, String filePath, Geometry geo, int size) {
        Dataset ds = null;
        filePath = "D:\\Moon\\data\\DOM\\test.tif";
        try {
            ds = gdal.Open(filePath);
            if (null == ds) {
@@ -234,15 +235,15 @@
        int yMinPixel = Math.max((int) Math.floor((maxY - env[3]) / pixelHeight), 1);
        int xMaxPixel = Math.min((int) Math.floor((env[1] - minX) / pixelWidth), xSize);
        int yMaxPixel = Math.min((int) Math.floor((maxY - env[2]) / pixelHeight), ySize);
        int bandCount = ds.getRasterCount();
        int width = Math.abs(xMaxPixel - xMinPixel);
        int height = Math.abs(yMaxPixel - yMinPixel);
        if (width < 1 || height < 1 || xMaxPixel < 1 || yMaxPixel < 1) {
        if (xMaxPixel < 1 || yMaxPixel < 1 || xMaxPixel - xMinPixel < 1 || yMaxPixel - yMinPixel < 1) {
            setError(entity, "查询范围无效");
            return;
        }
        int bandCount = ds.getRasterCount();
        int width = xMaxPixel - xMinPixel;
        int height = yMaxPixel - yMinPixel;
        if (width * height > StaticData.I64 * StaticData.I64) {
            readRasterForBlocks(entity, ds, bandCount, xMinPixel, yMinPixel, width, height);
            return;