• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GridCoverageFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.geotools.coverage.grid.GridCoverageFactory的典型用法代码示例。如果您正苦于以下问题:Java GridCoverageFactory类的具体用法?Java GridCoverageFactory怎么用?Java GridCoverageFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GridCoverageFactory类属于org.geotools.coverage.grid包,在下文中一共展示了GridCoverageFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: execute

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@DescribeResult(name = "result", description = "This is just a pass-through, the key is to provide enough information within invertQuery to perform a map to screen transform")
public GridCoverage2D execute(
		@DescribeParameter(name = "data", description = "Feature collection containing the rendered image")
		final SimpleFeatureCollection features )
		throws ProcessException {
	// vector-to-raster render transform that take a single feature that
	// wraps a distributed render result and converts it to a GridCoverage2D
	if (features != null) {
		final SimpleFeatureIterator it = features.features();
		if (it.hasNext()) {
			final SimpleFeature resultFeature = features.features().next();
			final DistributedRenderResult actualResult = (DistributedRenderResult) resultFeature.getAttribute(0);
			final DistributedRenderOptions renderOptions = (DistributedRenderOptions) resultFeature.getAttribute(1);
			// convert to the GridCoverage2D required for output
			final GridCoverageFactory gcf = CoverageFactoryFinder
					.getGridCoverageFactory(GeoTools.getDefaultHints());
			final BufferedImage result = actualResult.renderComposite(renderOptions);
			final GridCoverage2D gridCov = gcf.create(
					"Process Results",
					result,
					renderOptions.getEnvelope());
			return gridCov;
		}
	}
	return null;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:27,代码来源:InternalDistributedRenderProcess.java


示例2: testExactUpScale

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@Test
public void testExactUpScale() {
    float[][] grid = new float[][] {{1,2},{3,4}};
    final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
    final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null));
    GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 4, 4);
    final RenderedImage renderedImage = scaled.getRenderedImage();
    assertEquals(4, renderedImage.getWidth());
    assertEquals(4, renderedImage.getHeight());
    float[][] expected = new float[][] {{1,1,2,2},{1,1,2,2},{3,3,4,4},{3,3,4,4}};
    IntStream.range(0,4).forEach(i->IntStream.range(0, 4).forEach(j -> {
        float actual = scaled.evaluate(new GridCoordinates2D(j,i), new float[1])[0];
        assertEquals(expected[i][j], actual, 1e-10);
    }));
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:16,代码来源:GridCoverageUtilTest.java


示例3: testExactDownScale

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@Test
public void testExactDownScale() {
    float[][] grid = new float[][] {{1,1,2,2},{1,1,2,2},{3,3,4,4},{3,3,4,4}};
    final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
    final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null));
    GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 2,2);
    final RenderedImage renderedImage = scaled.getRenderedImage();
    assertEquals(2, renderedImage.getWidth());
    assertEquals(2, renderedImage.getHeight());
    float[][] expected = new float[][] {{1,2},{3,4}};
    IntStream.range(0,2).forEach(i->IntStream.range(0, 2).forEach(j -> {
        float actual = scaled.evaluate(new GridCoordinates2D(j,i), new float[1])[0];
        assertEquals(expected[i][j], actual, 1e-10);
    }));
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:16,代码来源:GridCoverageUtilTest.java


示例4: testInexactScale

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@Test
public void testInexactScale() {
    float[][] grid = new float[][] {{1,2},{3,4}};
    final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
    final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null));
    GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 3, 7);
    final RenderedImage renderedImage = scaled.getRenderedImage();
    assertEquals(7, renderedImage.getWidth());
    assertEquals(3, renderedImage.getHeight());
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:11,代码来源:GridCoverageUtilTest.java


示例5: testSmallScale

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@Test
public void testSmallScale() {
    float[][] grid = new float[1500][1500];
    final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
    final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null));
    GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 1501, 1499);
    final RenderedImage renderedImage = scaled.getRenderedImage();
    assertEquals(1499, renderedImage.getWidth());
    assertEquals(1501, renderedImage.getHeight());
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:11,代码来源:GridCoverageUtilTest.java


示例6: testLargeScale

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@Test
public void testLargeScale() {
    float[][] grid = new float[2][2];
    final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
    final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,1,0,1,null));
    GridCoverage2D scaled = GridCoverageUtil.scale(coverage, 1501, 1499);
    final RenderedImage renderedImage = scaled.getRenderedImage();
    assertEquals(1499, renderedImage.getWidth());
    assertEquals(1501, renderedImage.getHeight());
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:11,代码来源:GridCoverageUtilTest.java


示例7: testCrop

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@Test
public void testCrop() throws MismatchedDimensionException, NoSuchAuthorityCodeException, FactoryException {
    float[][] grid = new float[][] {{3,4},{1,2}};
    final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
    final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,20,0,20,null));
    final ReferencedEnvelope envelope = new ReferencedEnvelope(10,20,10,20,null);
    final GridCoverage2D croppedCoverage = GridCoverageUtil.crop(coverage, envelope);
    final RenderedImage renderedImage = croppedCoverage.getRenderedImage();
    assertEquals(1, renderedImage.getWidth());
    assertEquals(1, renderedImage.getHeight());
    assertEquals(4, croppedCoverage.evaluate(new Point2D.Double(15,15), new float[1])[0], 1e-10);
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:13,代码来源:GridCoverageUtilTest.java


示例8: createCoverage

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
/**
 * Creates the
 *
 * @param data
 * @return
 */
public GridCoverage2D createCoverage(float[] data, int columns, int rows) {
  GridCoverageFactory gcf = CoverageFactoryFinder.getGridCoverageFactory(null);
  TiledImage img = ceateImageContent(data, columns, rows);
  ReferencedEnvelope env = createEnvelope();
  return gcf.create("coverage", img, env);
}
 
开发者ID:MeteoGroup,项目名称:grib2geotiff,代码行数:13,代码来源:GeoTiffExporter.java


示例9: testSimpleScript2ImagesCombined

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@Test
public void testSimpleScript2ImagesCombined() throws Exception {

    if (testCoverage1 != null && testCoverage2 != null) {
        // Script selection
        String script = FileUtils.readFileToString(new File(JIFFLE_SCRIPT_PATH));
        // Combination of the bands of the 2 images
        RenderedImage img1 = testCoverage1.getRenderedImage();
        RenderedImage img2 = testCoverage2.getRenderedImage();

        RenderedImage imgComposed = BandMergeDescriptor.create(img1, img2, hints);

        GridCoverage2D composedCoverage = new GridCoverageFactory(null).create("New_cov",
                imgComposed, testCoverage1.getGridGeometry().getEnvelope());
        // Process calculation
        GridCoverage2D finalCoverage = process.execute(composedCoverage, script, null, 0);
        // Check the result
        assertNotNull(finalCoverage);

        RenderedImage finalImage = finalCoverage.getRenderedImage();

        assertEquals(finalImage.getSampleModel().getNumBands(), FINAL_NUM_BANDS);

        PlanarImage.wrapRenderedImage(finalImage).getTiles();

        checkExecution(finalImage, FINAL_VALUES, testCoverage1, testCoverage2);

        finalCoverage.dispose(true);
        if (finalImage instanceof RenderedOp) {
            ((RenderedOp) finalImage).dispose();
        }
    } else {
        LOGGER.log(
                Level.WARNING,
                "\nTest2: files not found in geoserver-enterprise/src/extension/wps/wps-core/src/test/java/org/geoserver/wps/raster/algebra");
    }
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:38,代码来源:JiffleScriptProcessTest.java


示例10: createCoverageFromTemplate

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
/**
 * Creates a new {@link GridCoverage2D} using an existing as template.
 * 
 * @param template the template to use.
 * @param value the value to set the new raster to, if not <code>null</code>.
 * @param writableRasterHolder an array of length 1 to place the writable raster in, that 
 *                  was can be used to populate the coverage. If <code>null</code>, it is ignored.
 * @return the new coverage.
 */
public static GridCoverage2D createCoverageFromTemplate( GridCoverage2D template, Double value,
        WritableRaster[] writableRasterHolder ) {
    RegionMap regionMap = getRegionParamsFromGridCoverage(template);

    double west = regionMap.getWest();
    double south = regionMap.getSouth();
    double east = regionMap.getEast();
    double north = regionMap.getNorth();
    int cols = regionMap.getCols();
    int rows = regionMap.getRows();
    ComponentSampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_DOUBLE, cols, rows, 1, cols, new int[]{0});

    WritableRaster raster = RasterFactory.createWritableRaster(sampleModel, null);
    if (value != null) {
        // autobox only once
        double v = value;
        for( int y = 0; y < rows; y++ ) {
            for( int x = 0; x < cols; x++ ) {
                raster.setSample(x, y, 0, v);
            }
        }
    }
    if (writableRasterHolder != null) {
        writableRasterHolder[0] = raster;
    }

    Envelope2D writeEnvelope = new Envelope2D(template.getCoordinateReferenceSystem(), west, south, east - west,
            north - south);
    GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);
    GridCoverage2D coverage2D = factory.create("newraster", raster, writeEnvelope);
    return coverage2D;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:42,代码来源:CoverageUtilities.java


示例11: createSubCoverageFromTemplate

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
/**
 * Create a subcoverage given a template coverage and an envelope.
 * 
 * @param template the template coverage used for the resolution.
 * @param subregion the envelope to extract to the new coverage. This should
 *                  be snapped on the resolution of the coverage, in order to avoid 
 *                  shifts.
 * @param value the value to set the new raster to, if not <code>null</code>. 
 * @param writableRasterHolder an array of length 1 to place the writable raster in, that 
 *                  was can be used to populate the coverage. If <code>null</code>, it is ignored.
 * @return the new coverage.
 */
public static GridCoverage2D createSubCoverageFromTemplate( GridCoverage2D template, Envelope2D subregion, Double value,
        WritableRaster[] writableRasterHolder ) {
    RegionMap regionMap = getRegionParamsFromGridCoverage(template);
    double xRes = regionMap.getXres();
    double yRes = regionMap.getYres();

    double west = subregion.getMinX();
    double south = subregion.getMinY();
    double east = subregion.getMaxX();
    double north = subregion.getMaxY();

    int cols = (int) ((east - west) / xRes);
    int rows = (int) ((north - south) / yRes);
    ComponentSampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_DOUBLE, cols, rows, 1, cols, new int[]{0});

    WritableRaster writableRaster = RasterFactory.createWritableRaster(sampleModel, null);
    if (value != null) {
        // autobox only once
        double v = value;
        for( int y = 0; y < rows; y++ ) {
            for( int x = 0; x < cols; x++ ) {
                writableRaster.setSample(x, y, 0, v);
            }
        }
    }
    if (writableRasterHolder != null)
        writableRasterHolder[0] = writableRaster;
    Envelope2D writeEnvelope = new Envelope2D(template.getCoordinateReferenceSystem(), west, south, east - west,
            north - south);
    GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);
    GridCoverage2D coverage2D = factory.create("newraster", writableRaster, writeEnvelope);
    return coverage2D;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:46,代码来源:CoverageUtilities.java


示例12: buildCoverage

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
/**
 * Creates a {@link GridCoverage2D coverage} from the {@link RenderedImage image} and the necessary geographic Information.
 * 
 * @param name the name of the coverage.
 * @param renderedImage the image containing the data.
 * @param envelopeParams the map of boundary parameters.
 * @param crs the {@link CoordinateReferenceSystem}.
 * @return the {@link GridCoverage2D coverage}.
 */
public static GridCoverage2D buildCoverage( String name, RenderedImage renderedImage, HashMap<String, Double> envelopeParams,
        CoordinateReferenceSystem crs ) {

    double west = envelopeParams.get(WEST);
    double south = envelopeParams.get(SOUTH);
    double east = envelopeParams.get(EAST);
    double north = envelopeParams.get(NORTH);
    Envelope2D writeEnvelope = new Envelope2D(crs, west, south, east - west, north - south);
    GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);

    GridCoverage2D coverage2D = factory.create(name, renderedImage, writeEnvelope);
    return coverage2D;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:23,代码来源:CoverageUtilities.java


示例13: saveRaster

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
/**
 * Save a set of raster data at a given location.
 * @param location The file location at which to save the raster.
 * @param raster The raw pixel values for the raster.
 * @param extents The extent of the raster.
 * @param properties The meta-data for the raster.
 * @throws IOException thrown if unable to save the raster.
 */
public static void saveRaster(File location, WritableRaster raster,
                              Envelope2D extents, GridSampleDimension[] properties) throws IOException {
    GridCoverage2D targetRaster = null;
    try {
        GridCoverageFactory factory = new GridCoverageFactory();
        targetRaster = factory.create(location.getName(), raster, extents, properties);
        saveRaster(location, targetRaster);
    } finally {
        disposeRaster(targetRaster);
    }
}
 
开发者ID:SEEG-Oxford,项目名称:ABRAID-MP,代码行数:20,代码来源:RasterUtils.java


示例14: exampleGridCoverageFactory

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@SuppressWarnings("unused")
void exampleGridCoverageFactory() throws Exception {
    
    ReferencedEnvelope referencedEnvelope = null;
    BufferedImage bufferedImage = null;
    // exampleGridCoverageFactory start
    GridCoverageFactory factory = new GridCoverageFactory();
    GridCoverage2D coverage = factory.create("GridCoverage", bufferedImage, referencedEnvelope);
    // exampleGridCoverageFactory end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:11,代码来源:CoverageExamples.java


示例15: convert

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
@Override
public GridCoverage2D convert(
		final String coverageName,
		final GridCoverage2D originalBandData,
		final SimpleFeature bandMetadata ) {
	final Object attrValue = bandMetadata.getAttribute(BandFeatureIterator.BAND_ATTRIBUTE_NAME);
	if ("BQA".equalsIgnoreCase(attrValue.toString())) {
		final MultiPixelPackedSampleModel newSampleModel = new MultiPixelPackedSampleModel(
				DataBuffer.TYPE_BYTE,
				originalBandData.getRenderedImage().getWidth(),
				originalBandData.getRenderedImage().getHeight(),
				2);
		final WritableRaster nextRaster = Raster.createWritableRaster(
				newSampleModel,
				null);
		final RenderedImage image = originalBandData.getRenderedImage();
		final Raster data = image.getData();
		for (int x = 0; x < data.getWidth(); x++) {
			for (int y = 0; y < data.getHeight(); y++) {
				final int sample = getIceSample(
						x,
						y,
						data);
				nextRaster.setSample(
						x,
						y,
						0,
						sample);
			}
		}
		final GridCoverage2D nextCov = new GridCoverageFactory().create(
				coverageName,
				nextRaster,
				originalBandData.getEnvelope());
		return nextCov;
	}
	return originalBandData;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:39,代码来源:QABandToIceMaskConverter.java


示例16: bind

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
/**
 * Binding function
 * 
 * @param image buffered image that needs to be binded
 * @param filename absolute path of result tiff file with binded image
 * @param left left border of bound rectangle
 * @param top top border of bound rectangle
 * @param right right border of bound rectangle
 * @param bottom bottom border of bound rectangle 
 * @param crsWKT well-known text that describes coordinate reference system
 *         
 */
public final static void bind(BufferedImage image,String filename, double left, double top, double right, double bottom, String crsWKT, boolean usingJpegCompression, float jpegQuality) throws IOException, FactoryException{
	final File f = new File(filename);
	final ImageOutputStream imageOutStream = ImageIO.createImageOutputStream(f);
	final GeoTiffWriter writer = new GeoTiffWriter(imageOutStream);
	
	final GeoTiffFormat format = new GeoTiffFormat();
	final GeoTiffWriteParams wp = new GeoTiffWriteParams();
	wp.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
	if (usingJpegCompression){
		wp.setCompressionType("JPEG");
		wp.setCompressionQuality(jpegQuality/100F);
	}
	wp.setTilingMode(GeoToolsWriteParams.MODE_EXPLICIT);
	wp.setTiling(256, 256);
	 
	final ParameterValueGroup writerParams = format.getWriteParameters();
	writerParams.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString())
	            .setValue(wp);
	
	CoordinateReferenceSystem crs = CRS.parseWKT(crsWKT);
	ReferencedEnvelope envelope = new ReferencedEnvelope(left, right, top, bottom, crs);
	GridCoverageFactory factory = new GridCoverageFactory();
	GridCoverage2D gc = factory.create("IMG", image, envelope);
	writer.write(gc, (GeneralParameterValue[]) writerParams.values().toArray(new GeneralParameterValue[1]));
	imageOutStream.flush();
	imageOutStream.close();
   }
 
开发者ID:SVoyt,项目名称:pyramaker,代码行数:40,代码来源:ImageBinder.java


示例17: bufferedImageToGridCoverage2D

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
public static GridCoverage2D bufferedImageToGridCoverage2D(
    BufferedImage image, Envelope env) {
  GridCoverageFactory coverageFactory = new GridCoverageFactory();
  GridCoverage2D newCoverage = coverageFactory.create("coverage", image, env);
  return newCoverage;
}
 
开发者ID:IGNF,项目名称:geoxygene,代码行数:7,代码来源:ImageUtil.java


示例18: toGridCoverage2D

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
public GridCoverage2D toGridCoverage2D() {
    final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
    return coverageFactory.create("geohashGridAgg", grid, boundingBox);
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:5,代码来源:GeoHashGrid.java


示例19: buildRasterMap

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
/**
 * 
 * @param soilSealingIndexResult
 * @param indexValue
 * @param inputCov
 * @param refWsName
 * @param defaultStyle
 */
private void buildRasterMap(SoilSealingDTO soilSealingIndexResult,
        List<StatisticContainer> indexValue, GridCoverage2D inputCov, String refWsName,
        String defaultStyle) {

    StatisticContainer container = indexValue.get(0);

    // Selection of the images
    RenderedImage referenceImage = container.getReferenceImage();

    RenderedImage nowImage = container.getNowImage();

    RenderedImage diffImage = container.getDiffImage();

    // Selection of the names associated to the reference and current times
    String time = "" + System.nanoTime();

    final String rasterRefName = "referenceUrbanGrids";
    final String rasterCurName = "currentUrbanGrids";
    final String rasterDiffName = "diffUrbanGrids";
    // Creation of the final Coverages
    // hints for tiling
    final Hints hints = GeoTools.getDefaultHints().clone();

    GridCoverageFactory factory = new GridCoverageFactory(hints);

    Envelope envelope = inputCov.getEnvelope();

    GridCoverage2D reference = factory.create(rasterRefName + time, referenceImage, envelope);

    GridCoverage2D now = null;

    GridCoverage2D diff = null;
    // Creation of the coverages for the current and difference images
    if (nowImage != null) {
        if (diffImage == null) {
            throw new ProcessException("Unable to calculate the difference image for index 8");
        }

        now = factory.create(rasterCurName + time, nowImage, envelope);

        diff = factory.create(rasterDiffName + time, diffImage, envelope);
    }

    /**
     * Import the GridCoverages as new Layers
     */
    // Importing of the Reference Coverage
    ImportProcess importProcess = new ImportProcess(catalog);
    importProcess.execute(null, reference, refWsName, null, reference.getName().toString(),
            reference.getCoordinateReferenceSystem(), null, defaultStyle);

    soilSealingIndexResult.getRefTime().getOutput()
            .setLayerName(refWsName + ":" + reference.getName().toString());

    // Importing of the current and difference coverages if present
    if (now != null) {
        // Current coverage
        importProcess.execute(null, now, refWsName, null, now.getName().toString(),
                now.getCoordinateReferenceSystem(), null, defaultStyle);

        soilSealingIndexResult.getCurTime().getOutput()
                .setLayerName(refWsName + ":" + now.getName().toString());

        // Difference coverage
        importProcess.execute(null, diff, refWsName, null, diff.getName().toString(),
                diff.getCoordinateReferenceSystem(), null, defaultStyle);

        soilSealingIndexResult.setDiffImageName(refWsName + ":" + diff.getName().toString());
    }
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:79,代码来源:SoilSealingImperviousnessProcess.java


示例20: createImage

import org.geotools.coverage.grid.GridCoverageFactory; //导入依赖的package包/类
public static GridCoverage2D createImage(boolean reference) {

        SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, DEF_W, DEF_H, 1, DEF_W,
                new int[] { 0 });

        TiledImage img = new TiledImage(sm, DEF_TILE_W, DEF_TILE_H);

        int minX = 0;
        int maxX = 0;
        int minY = 0;
        int maxY = 0;

        if (reference) {
            minX = 10;
            maxX = 20;
            minY = 10;
            maxY = 20;
        } else {
            minX = 11;
            maxX = 20;
            minY = 10;
            maxY = 20;
        }

        int minPolStart = 0;
        int maxPolStart = 5;

        for (int i = minPolStart; i < maxPolStart; i++) {
            for (int j = minPolStart; j < maxPolStart; j++) {
                img.setSample(i, j, 0, 1);
            }
        }

        for (int i = minX; i < maxX; i++) {
            for (int j = minY; j < maxY; j++) {
                img.setSample(i, j, 0, 1);
            }
        }

        Envelope envelope = new Envelope2D(crs, 0, 0, DEF_W, DEF_H);

        GridCoverage2D result = new GridCoverageFactory(GeoTools.getDefaultHints()).create("test",
                img, envelope);

        return result;
    }
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:47,代码来源:UrbanGridProcessTest.java



注:本文中的org.geotools.coverage.grid.GridCoverageFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EParameter类代码示例发布时间:2022-05-22
下一篇:
Java Query类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap