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

Java CoverageFactoryFinder类代码示例

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

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



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

示例1: execute

import org.geotools.coverage.CoverageFactoryFinder; //导入依赖的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.CoverageFactoryFinder; //导入依赖的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.CoverageFactoryFinder; //导入依赖的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.CoverageFactoryFinder; //导入依赖的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.CoverageFactoryFinder; //导入依赖的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.CoverageFactoryFinder; //导入依赖的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.CoverageFactoryFinder; //导入依赖的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.CoverageFactoryFinder; //导入依赖的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: createCoverageFromTemplate

import org.geotools.coverage.CoverageFactoryFinder; //导入依赖的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


示例10: createSubCoverageFromTemplate

import org.geotools.coverage.CoverageFactoryFinder; //导入依赖的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


示例11: buildCoverage

import org.geotools.coverage.CoverageFactoryFinder; //导入依赖的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


示例12: toGridCoverage2D

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


示例13: createTestCoverage

import org.geotools.coverage.CoverageFactoryFinder; //导入依赖的package包/类
/**
 * creates a coverage for testing purposes-
 * 
 * @param width width in pixel of the raster
 * @param height height in pixel of the raster
 * @param envX0 envelope minx
 * @param envY0 envelope miny
 * @param envWidth envelope width
 * @param envHeight envelope height
 * @return the test coverage
 */
protected static GridCoverage2D createTestCoverage(final int width, final int height,
        final double envX0, final double envY0, final double envWidth, final double envHeight) {

    final GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);

    WritableRaster raster = RasterFactory.createBandedRaster(DataBuffer.TYPE_FLOAT, width,
            height, 1, null);
    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            if (x < 50 && y < 50) { // upper left square: vertical lines
                if (x % 5 == 0)
                    raster.setSample(x, y, 0, 0);
                else
                    raster.setSample(x, y, 0, width);
            } else if (x < 50 && y > height - 50) { // lower left square: horizontal lines
                if (y % 5 == 0)
                    raster.setSample(x, y, 0, 0);
                else
                    raster.setSample(x, y, 0, width);
            } else if (x > width - 50 && y < 50) { // upper right square: descending diagonal lines
                if ((x - y) % 5 == 0)
                    raster.setSample(x, y, 0, 0);
                else
                    raster.setSample(x, y, 0, width);
            } else if (x > width - 50 && y > height - 50) { // lower right square: ascending diagonal lines
                if ((x + y) % 5 == 0)
                    raster.setSample(x, y, 0, 0);
                else
                    raster.setSample(x, y, 0, width);
            } else if (x % 50 == 0 || y % 50 == 0 || (x - y) % 100 == 0)
                raster.setSample(x, y, 0, 0); // bigger lines
            else
                raster.setSample(x, y, 0, x + y); // normal background
        }
    }
    final Color[] colors = new Color[] { Color.BLUE, Color.CYAN, Color.WHITE, Color.YELLOW,
            Color.RED };

    return factory.create("Float coverage", raster, new Envelope2D(DefaultGeographicCRS.WGS84,
            envX0, envY0, envWidth, envHeight), null, null, null, new Color[][] { colors },
            null);
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:54,代码来源:Coverage2RenderedImageAdapterTest.java


示例14: view

import org.geotools.coverage.CoverageFactoryFinder; //导入依赖的package包/类
private static void view(RenderedImage ri, GridGeometry2D gg, GridSampleDimension[] gsd) {
    final GridCoverageFactory factory = CoverageFactoryFinder.getGridCoverageFactory(null);

    GridCoverage2D rendered = factory.create("Merged coverage", ri, gg, gsd, null, null);

    rendered.view(ViewType.RENDERED).show();
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:8,代码来源:Coverage2RenderedImageAdapterTest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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