月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-09-11 2b9379e1e4a55e637dc370d9881d7bb9bb0793da
修改栅格分析的面查询
已修改2个文件
12 ■■■■ 文件已修改
src/main/java/com/moon/server/controller/data/RasterAnalysisController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/service/data/RasterAnalysisService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/moon/server/controller/data/RasterAnalysisController.java
@@ -63,7 +63,7 @@
    @SysLog()
    @ApiOperation(value = "查询线分析")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wkt", value = "线WKT", dataType = "String", example = "LINESTRING(115.94927385452 32.3754479115071,121.989371092554 32.2766788010181,121.850621222894 29.6874200067864)")
            @ApiImplicitParam(name = "wkt", value = "线WKT", dataType = "String", example = "LINESTRING(165.680851 31.333443,166.383982 31.283475,166.016355 30.908709)")
    })
    @GetMapping(value = "/selectByPolyline")
    public ResponseMsg<Object> selectByPolyline(String wkt) {
@@ -87,7 +87,7 @@
    @SysLog()
    @ApiOperation(value = "查询面分析")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wkt", value = "面WKT", dataType = "String", example = "POLYGON ((115.94927385452 32.3754479115071,121.989371092554 32.2766788010181,121.850621222894 29.6874200067864,115.9727267226 29.7835368627922,115.94927385452 32.3754479115071))")
            @ApiImplicitParam(name = "wkt", value = "面WKT", dataType = "String", example = "POLYGON ((165.680851 31.333443,166.383982 31.283475,166.016355 30.908709,165.680851 31.333443))")
    })
    @GetMapping(value = "/selectByPolygon")
    public ResponseMsg<Object> selectByPolygon(String wkt) {
src/main/java/com/moon/server/service/data/RasterAnalysisService.java
@@ -134,7 +134,7 @@
        // double rotationX = transform[2]; double rotationY = transform[4]
        double minX = transform[0], pixelWidth = transform[1], maxY = transform[3], pixelHeight = transform[5];
        double[] bounds = new double[6];
        double[] bounds = new double[4];
        polyline.GetEnvelope(bounds);
        double startX = bounds[0], endX = bounds[1], startY = bounds[2], endY = bounds[3];
@@ -169,13 +169,13 @@
        double[] transform = ds.GetGeoTransform();
        // double rotationX = transform[2]; double rotationY = transform[4]
        double minX = transform[0], pixelWidth = transform[1], maxY = transform[3], pixelHeight = transform[5];
        double[] env = new double[6];
        double[] env = new double[4];
        polygon.GetEnvelope(env);
        int xMinPixel = (int) Math.floor((env[0] - minX) / pixelWidth);
        int yMinPixel = (int) Math.floor((maxY - env[3]) / Math.abs(pixelHeight));
        int yMinPixel = (int) Math.floor((maxY - env[2]) / Math.abs(pixelHeight));
        int xMaxPixel = (int) Math.floor((env[1] - minX) / pixelWidth);
        int yMaxPixel = (int) Math.floor((maxY - env[2]) / Math.abs(pixelHeight));
        int yMaxPixel = (int) Math.floor((maxY - env[3]) / Math.abs(pixelHeight));
        int bandCount = ds.getRasterCount();
        int geoWidth = Math.abs(xMaxPixel - xMinPixel);