本文整理汇总了Java中org.geotools.coverage.grid.io.AbstractGridFormat类的典型用法代码示例。如果您正苦于以下问题:Java AbstractGridFormat类的具体用法?Java AbstractGridFormat怎么用?Java AbstractGridFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractGridFormat类属于org.geotools.coverage.grid.io包,在下文中一共展示了AbstractGridFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: bind
import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的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: createRasterLayer
import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
private Layer createRasterLayer(File file, DataSet target_dataset)
throws IOException {
// declaration & initialization
Layer layer = null;
AbstractGridCoverage2DReader reader;
// Give a name to the population
String populationName = popNameFromFile(file.getPath());
// Find the file format
AbstractGridFormat format = GridFormatFinder.findFormat(file);
// Find out if we can read the file ...
// Unkown Format is not a typo from me, it is a typo from Geotools ...
if (format.getName() != "Unkown Format") {
reader = format.getReader(file);
} else {
System.err.println("Unknown file format for : " + file.getName());
return null;
}
// ... and do it
GridCoverage2D coverage = (GridCoverage2D) reader.read(null);
// create a population
Population<FT_Coverage> population = new Population<FT_Coverage>(
populationName);
org.opengis.geometry.Envelope envelope = coverage.getEnvelope();
// put the envelope of the image in the population
population.setEnvelope(
new GM_Envelope(envelope.getLowerCorner().getCoordinate()[0],
envelope.getUpperCorner().getCoordinate()[0],
envelope.getLowerCorner().getCoordinate()[1],
envelope.getUpperCorner().getCoordinate()[1]));
// add the data to the population
population.add(new FT_Coverage(coverage));
target_dataset.addPopulation(population);
// create a layer
layer = this.createLayer(populationName);
return layer;
}
开发者ID:IGNF,项目名称:geoxygene,代码行数:47,代码来源:LayerFactory.java
示例18: createFormat
import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
public AbstractGridFormat createFormat()
{
return new MrGeoFormat(config);
}
开发者ID:ngageoint,项目名称:mrgeo-geoserver-plugin,代码行数:5,代码来源:MrGeoFormatFactorySpi.java
示例19: addSource
import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
protected void addSource( File imageMosaicSource ) throws IOException {
URL imageMosaicUrl = imageMosaicSource.toURI().toURL();
final AbstractGridFormat imageMosaicFormat = (AbstractGridFormat) GridFormatFinder.findFormat(imageMosaicUrl);
final ImageMosaicReader imReader = (ImageMosaicReader) imageMosaicFormat.getReader(imageMosaicUrl);
// ImageMosaicReader imReader = new ImageMosaicReader(imageMosaicSource);
if (readers.size() == 0) {
File propertiesFile = FileUtilities.substituteExtention(imageMosaicSource, "properties");
HashMap<String, String> propertiesMap = FileUtilities
.readFileToHashMap(propertiesFile.getAbsolutePath(), null, false);
String xyREs = propertiesMap.get("Levels");
String[] split = xyREs.split(",");
xRes = Double.parseDouble(split[0]);
yRes = Double.parseDouble(split[1]);
locationField = propertiesMap.get("LocationAttribute");
crs = imReader.getCoordinateReferenceSystem();
GeneralEnvelope originalEnvelope = imReader.getOriginalEnvelope();
llCorner = originalEnvelope.getLowerCorner().getCoordinate();
urCorner = originalEnvelope.getUpperCorner().getCoordinate();
SimpleFeatureCollection vectorBounds = OmsVectorReader.readVector(imageMosaicSource.getAbsolutePath());
boundsGeometries = FeatureUtilities.featureCollectionToGeometriesList(vectorBounds, true, locationField);
Envelope singleTileEnv = boundsGeometries.get(0).getEnvelopeInternal();
Envelope allTilesEnv = new Envelope();
for( Geometry boundsGeometry : boundsGeometries ) {
allTilesEnv.expandToInclude(boundsGeometry.getEnvelopeInternal());
}
if (allTilesEnv.getWidth() > singleTileEnv.getWidth()) {
isSingleInX = false;
}
if (allTilesEnv.getHeight() > singleTileEnv.getHeight()) {
isSingleInY = false;
}
}
readers.add(imReader);
}
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:43,代码来源:HMModelIM.java
示例20: addImageMosaic
import org.geotools.coverage.grid.io.AbstractGridFormat; //导入依赖的package包/类
private void addImageMosaic( MapContent map ) throws Exception {
if (inImageMosaics != null) {
RasterSymbolizer sym = sf.getDefaultRasterSymbolizer();
Style style = SLD.wrapSymbolizers(sym);
final ParameterValue<Color> inTransp = AbstractGridFormat.INPUT_TRANSPARENT_COLOR.createValue();
inTransp.setValue(Color.white);
final ParameterValue<Color> outTransp = ImageMosaicFormat.OUTPUT_TRANSPARENT_COLOR.createValue();
outTransp.setValue(Color.white);
final ParameterValue<Color> backColor = ImageMosaicFormat.BACKGROUND_COLOR.createValue();
backColor.setValue(Color.RED);
final ParameterValue<Boolean> fading = ImageMosaicFormat.FADING.createValue();
fading.setValue(true);
final ParameterValue<Interpolation> interpol = ImageMosaicFormat.INTERPOLATION.createValue();
interpol.setValue(new javax.media.jai.InterpolationBilinear());
final ParameterValue<Boolean> resol = ImageMosaicFormat.ACCURATE_RESOLUTION.createValue();
resol.setValue(true);
final ParameterValue<Boolean> multiThread= ImageMosaicFormat.ALLOW_MULTITHREADING.createValue();
multiThread.setValue(true);
final ParameterValue<Boolean> usejai = ImageMosaicFormat.USE_JAI_IMAGEREAD.createValue();
usejai.setValue(false);
final ParameterValue<double[]> bkg = ImageMosaicFormat.BACKGROUND_VALUES.createValue();
bkg.setValue(new double[]{0});
GeneralParameterValue[] gp = new GeneralParameterValue[]{inTransp, multiThread};
for( String imageMosaicPath : inImageMosaics ) {
ImageMosaicReader imr = new ImageMosaicReader(new File(imageMosaicPath));
GridReaderLayer layer = new GridReaderLayer(imr, style, gp);
map.addLayer(layer);
}
}
}
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:42,代码来源:OmsMapsViewer.java
注:本文中的org.geotools.coverage.grid.io.AbstractGridFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论