本文整理汇总了Java中org.geotools.coverage.grid.io.GridFormatFinder类的典型用法代码示例。如果您正苦于以下问题:Java GridFormatFinder类的具体用法?Java GridFormatFinder怎么用?Java GridFormatFinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridFormatFinder类属于org.geotools.coverage.grid.io包,在下文中一共展示了GridFormatFinder类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: choose
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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: run
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例3: getRenderer
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例4: exampleGridCoverageDirect
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例5: supportsFile
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例6: main
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例7: exampleGridFormat
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例8: exampleGridCoverageUsing
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例9: SaveMapAsImage
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例10: createRasterLayer
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
示例11: addSource
import org.geotools.coverage.grid.io.GridFormatFinder; //导入依赖的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
注:本文中的org.geotools.coverage.grid.io.GridFormatFinder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论