| | |
| | | */ |
| | | 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) { |
| | |
| | | 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; |