| | |
| | | import com.moon.server.helper.StringHelper; |
| | | import com.moon.server.helper.WebHelper; |
| | | import com.moon.server.service.data.RasterAnalysisService; |
| | | import com.moon.server.service.data.SlopeAnalysisService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 栅格分析 |
| | | * @author WWW |
| | | * @date 2023-08-23 |
| | | */ |
| | | @Api(tags = "数据管理\\栅格分析") |
| | | @RestController |
| | | @SuppressWarnings("ALL") |
| | | @RequestMapping("/rasterAnalysis") |
| | | public class RasterAnalysisController extends BaseController { |
| | | @Resource |
| | | RasterAnalysisService rasterService; |
| | | |
| | | @Resource |
| | | SlopeAnalysisService slopeAnalysisService; |
| | | |
| | | private final static List<Integer> PIXELS = new ArrayList<>(Arrays.asList(1, 2, 4, 8, 16, 32, 64, 128, 256)); |
| | | |
| | |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "下载坡度分析Excel") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "wkt", value = "WKT字符串", dataType = "String", example = "POLYGON ((-73.093 4.598,-72.494 4.669,-72.951 4.241,-73.093 4.598))") |
| | | }) |
| | | @GetMapping(value = "/downloadSlopXls") |
| | | public void downloadSlopXls(String wkt, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (StringHelper.isEmpty(wkt)) { |
| | | WebHelper.writeStr2Page(res, "WKT字符串不能为空"); |
| | | return; |
| | | } |
| | | Geometry geo = Geometry.CreateFromWkt(wkt); |
| | | if (null == geo) { |
| | | WebHelper.writeStr2Page(res, "WKT字符串不正确"); |
| | | return; |
| | | } |
| | | int wktType = geo.GetGeometryType(); |
| | | if (wktType != ogr.wkbPolygon) { |
| | | WebHelper.writeStr2Page(res, "WKT字符串只支持面类型"); |
| | | return; |
| | | } |
| | | |
| | | slopeAnalysisService.downloadSlopXls(geo, res); |
| | | } catch (Exception ex) { |
| | | WebHelper.writeStr2Page(res, ex.getMessage()); |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |