当前位置: 首页>>代码示例>>Java>>正文


Java AbstractGridFormat类代码示例

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


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

示例1: choose

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
/**
 * Get user to choose raster format.
 *
 * @param rasterFile the raster file
 * @param selectionPanel the selection panel
 * @return the abstract grid format
 */
public static AbstractGridFormat choose(File rasterFile,
        ChooseRasterFormatInterface selectionPanel) {
    if (rasterFile != null) {
        final Set<AbstractGridFormat> formats = GridFormatFinder.findFormats(rasterFile,
                GeoTools.getDefaultHints());

        if (formats.size() > 1) {
            if (selectionPanel != null) {
                AbstractGridFormat selectedFormat = selectionPanel.showPanel(formats);
                if (selectedFormat != null) {
                    return selectedFormat;
                }
            }
        }

        // otherwise just pick the first
        final Iterator<AbstractGridFormat> it = formats.iterator();
        if (it.hasNext()) {
            return it.next();
        }
    }
    return new UnknownFormat();
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:31,代码来源:DetermineRasterFormat.java

示例2: testChoose

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
/**
 * Test method for
 * {@link com.sldeditor.datasource.chooseraster.DetermineRasterFormat#choose(java.io.File, com.sldeditor.datasource.chooseraster.ChooseRasterFormatInterface)}.
 */
@Test
public void testChoose() {
    AbstractGridFormat gridFormat = DetermineRasterFormat.choose(null, null);
    assertTrue(UnknownFormat.class == gridFormat.getClass());

    URL url = SLDTreeTest.class.getResource("/raster/sld/sld_cookbook_raster.tif");

    File f = new File(url.getFile());
    gridFormat = DetermineRasterFormat.choose(f, null);

    assertTrue(gridFormat != null);

    // Force to WorldImageFormat
    gridFormat = DetermineRasterFormat.choose(f, new ChooseRasterFormatInterface() {

        @Override
        public AbstractGridFormat showPanel(Set<AbstractGridFormat> formatList) {
            WorldImageFormat wif = new WorldImageFormat();

            return wif;
        }
    });

    assertTrue(WorldImageFormat.class == gridFormat.getClass());
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:30,代码来源:DetermineRasterFormatTest.java

示例3: run

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
@Override
public void run() {
	final Display display = WorkbenchHelper.getDisplay();
	final Shell shell = new Shell(display);
	final File openFile = JFileImageChooser.showOpenFile(shell);

	if (openFile != null && openFile.exists()) {
		final AbstractGridFormat format = GridFormatFinder.findFormat(openFile);
		final AbstractGridCoverage2DReader tiffReader = format.getReader(openFile);
		final StyleFactoryImpl sf = new StyleFactoryImpl();
		final RasterSymbolizer symbolizer = sf.getDefaultRasterSymbolizer();
		final Style defaultStyle = SLD.wrapSymbolizers(symbolizer);

		final MapContent mapContent = mapPane.getMapContent();
		final Layer layer = new GridReaderLayer(tiffReader, defaultStyle);
		layer.setTitle(openFile.getName());
		mapContent.addLayer(layer);
		mapPane.redraw();
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:21,代码来源:OpenGeotiffAction.java

示例4: getRenderer

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
private static GTRenderer getRenderer( File rasterFile ) {

        AbstractGridFormat format = GridFormatFinder.findFormat(rasterFile);
        AbstractGridCoverage2DReader coverageReader = format.getReader(rasterFile);

        MapContent mapContent = new MapContent();
        try {

            Style rasterStyle = SldUtilities.getStyleFromFile(rasterFile);
            if (rasterStyle == null) {
                RasterSymbolizer sym = SldUtilities.sf.getDefaultRasterSymbolizer();
                rasterStyle = SLD.wrapSymbolizers(sym);
            }

            GridReaderLayer layer = new GridReaderLayer(coverageReader, rasterStyle);
            mapContent.addLayer(layer);
            mapContent.getViewport().setCoordinateReferenceSystem(CrsUtilities.WGS84);
        } catch (Exception e) {
            e.printStackTrace();
        }
        GTRenderer renderer = new StreamingRenderer();
        renderer.setMapContent(mapContent);
        return renderer;
    }
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:25,代码来源:GridCoverageNwwLayer.java

示例5: exampleGridCoverageDirect

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
void exampleGridCoverageDirect() throws Exception {
    double x =0;
    double y = 0;
    CoordinateReferenceSystem crs = null;
    
    File file = new File("test.tiff");
    AbstractGridFormat format = GridFormatFinder.findFormat(file);
    GridCoverage2DReader reader = format.getReader(file);
    // exampleGridCoverageDirect start
    GridCoverage2D coverage = reader.read(null);
    
    // direct access
    DirectPosition position = new DirectPosition2D( crs, x, y);
    
    double[] sample = (double[]) coverage.evaluate( position ); // assume double
    
    // resample with the same array
    sample = coverage.evaluate( position, sample );
    // exampleGridCoverageDirect end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:21,代码来源:CoverageExamples.java

示例6: supportsFile

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
@Override
public boolean supportsFile(
		final URL file ) {
	AbstractGridFormat format = null;
	try {
		format = GridFormatFinder.findFormat(file);
	}
	catch (final Exception e) {
		LOGGER.info(
				"Unable to support as raster file",
				e);
	}
	// the null check is enough and we don't need to check the format
	// accepts this file because the finder should have previously validated
	// this
	return (format != null);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:GeoToolsRasterDataStoreIngestPlugin.java

示例7: createWriteParameters

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
/**
 * Collect parameters to configure a tiles and compressed GeoTiff
 * see http://docs.geotools.org/stable/javadocs/org/geotools/gce/geotiff/GeoTiffWriteParams.html
 *
 * @return
 */
private GeneralParameterValue[] createWriteParameters() {

  final GeoTiffFormat format = new GeoTiffFormat();

  final GeoTiffWriteParams wp = new GeoTiffWriteParams();

  wp.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
  wp.setCompressionType("LZW");

  wp.setTilingMode(GeoToolsWriteParams.MODE_EXPLICIT);
  wp.setTiling(TILE_SIZE, TILE_SIZE);

  final ParameterValueGroup params = format.getWriteParameters();
  params.parameter(
      AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString())
      .setValue(wp);

  GeneralParameterValue[] writeParameters = params.values().toArray(new GeneralParameterValue[1]);

  return writeParameters;
}
 
开发者ID:MeteoGroup,项目名称:grib2geotiff,代码行数:28,代码来源:GeoTiffExporter.java

示例8: main

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
    String ctp = "/home/hydrologis/data/CTP/trentino_ctp/ctp.shp";
    File file = new File(ctp);
    AbstractGridFormat format = GridFormatFinder.findFormat(file);
    AbstractGridCoverage2DReader reader = format.getReader(file);
    BufferedImage image = MBTilesHelper.readGridcoverageImageForTile(reader, 1, 1, 19, null);

}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:9,代码来源:MBTilesHelper.java

示例9: writeArcGrid

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
private void writeArcGrid( File mapFile ) throws Exception {
    final ArcGridFormat format = new ArcGridFormat();
    final ArcGridWriteParams wp = new ArcGridWriteParams();
    final ParameterValueGroup paramWrite = format.getWriteParameters();
    paramWrite.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue(wp);
    ArcGridWriter gtw = (ArcGridWriter) format.getWriter(new File(file));
    gtw.write(inRaster, (GeneralParameterValue[]) paramWrite.values().toArray(new GeneralParameterValue[1]));
    gtw.dispose();
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:10,代码来源:OmsRasterWriter.java

示例10: writeGeotiff

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
private void writeGeotiff( File mapFile ) throws Exception {
    final GeoTiffFormat format = new GeoTiffFormat();
    final GeoTiffWriteParams wp = new GeoTiffWriteParams();
    wp.setCompressionMode(GeoTiffWriteParams.MODE_DEFAULT);
    wp.setTilingMode(GeoToolsWriteParams.MODE_DEFAULT);
    final ParameterValueGroup paramWrite = format.getWriteParameters();
    paramWrite.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue(wp);
    GeoTiffWriter gtw = (GeoTiffWriter) format.getWriter(mapFile);
    gtw.write(inRaster, (GeneralParameterValue[]) paramWrite.values().toArray(new GeneralParameterValue[1]));
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:11,代码来源:OmsRasterWriter.java

示例11: getGeoTiffWriteParameters

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
private static GeneralParameterValue[] getGeoTiffWriteParameters() {
    GeoTiffWriteParams writeParams = new GeoTiffWriteParams();
    writeParams.setCompressionMode(GeoTiffWriteParams.MODE_EXPLICIT);
    writeParams.setCompressionType(GEOTIFF_COMPRESSION_TYPE);
    writeParams.setCompressionQuality(GEOTIFF_COMPRESSION_QUALITY);
    ParameterValue parameterValue = AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.createValue();
    parameterValue.setValue(writeParams);
    return new GeneralParameterValue[] {
            parameterValue
    };
}
 
开发者ID:SEEG-Oxford,项目名称:ABRAID-MP,代码行数:12,代码来源:RasterUtils.java

示例12: exampleGridFormat

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
@SuppressWarnings("unused")
void exampleGridFormat() throws Exception {
    
    // exampleGridFormat start
    File file = new File("test.tiff");
    
    AbstractGridFormat format = GridFormatFinder.findFormat(file);
    GridCoverage2DReader reader = format.getReader(file);
    
    GridCoverage2D coverage = reader.read(null);
    // exampleGridFormat end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:13,代码来源:CoverageExamples.java

示例13: exampleGridCoverageUsing

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
@SuppressWarnings("unused")
void exampleGridCoverageUsing() throws Exception {
    File file = new File("test.tiff");
    AbstractGridFormat format = GridFormatFinder.findFormat(file);
    GridCoverage2DReader reader = format.getReader(file);
    // exampleGridCoverageUsing start
    GridCoverage2D coverage = reader.read(null);
    
    CoordinateReferenceSystem crs = coverage.getCoordinateReferenceSystem2D();
    Envelope env = coverage.getEnvelope();
    RenderedImage image = coverage.getRenderedImage();
    // exampleGridCoverageUsing end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:14,代码来源:CoverageExamples.java

示例14: SaveMapAsImage

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
public SaveMapAsImage(File file, File raster) throws IOException {

		FileDataStore store = FileDataStoreFinder.getDataStore(file);
		SimpleFeatureSource featureSource = store.getFeatureSource();

		// Create a map content and add our shapefile to it
		mapContent = new MapContent();
		mapContent.setTitle("GeoTools Mapping");
		AbstractGridFormat format = GridFormatFinder.findFormat(raster);
		AbstractGridCoverage2DReader reader = format.getReader(raster);
		GridCoverage2D cov;
		try {
			cov = reader.read(null);
		} catch (IOException giveUp) {
			throw new RuntimeException(giveUp);
		}
		Style rasterStyle = createRGBStyle(cov);
		Layer rasterLayer = new GridReaderLayer(reader, rasterStyle);
		mapContent.addLayer(rasterLayer);

		Style style = SLD.createSimpleStyle(featureSource.getSchema());
		Layer layer = new FeatureLayer(featureSource, style);
		mapContent.addLayer(layer);
		mapContent.getViewport().setCoordinateReferenceSystem(
				DefaultGeographicCRS.WGS84);
		frame = new JMapFrame(mapContent);
		frame.enableStatusBar(true);
		frame.enableToolBar(true);
		JToolBar toolBar = frame.getToolBar();
		toolBar.addSeparator();
		SaveAction save = new SaveAction("Save");
		toolBar.add(save);
		frame.initComponents();
		frame.setSize(1000, 500);
		frame.setVisible(true);
	}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:37,代码来源:SaveMapAsImage.java

示例15: renderGridCoverage

import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
public GridCoverage2D renderGridCoverage(
		final String coverageName,
		final Rectangle dim,
		final GeneralEnvelope generalEnvelope,
		Color backgroundColor,
		Color outputTransparentColor,
		final Interpolation interpolation )
		throws IOException {
	if (backgroundColor == null) {
		backgroundColor = AbstractGridFormat.BACKGROUND_COLOR.getDefaultValue();
	}
	if (outputTransparentColor == null) {
		outputTransparentColor = GeoWaveGTRasterFormat.OUTPUT_TRANSPARENT_COLOR.getDefaultValue();
	}

	final GeoWaveRasterReaderState state = new GeoWaveRasterReaderState(
			coverageName);
	state.setRequestedEnvelope(generalEnvelope);
	// /////////////////////////////////////////////////////////////////////
	//
	// Loading tiles trying to optimize as much as possible
	//
	// /////////////////////////////////////////////////////////////////////
	final GridCoverage2D coverage = loadTiles(
			coverageName,
			backgroundColor,
			outputTransparentColor,
			interpolation,
			dim,
			state,
			crs,
			getOriginalEnvelope(coverageName));

	return coverage;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:36,代码来源:GeoWaveRasterReader.java


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