本文整理汇总了Java中org.opengis.geometry.Envelope.getMaximum方法的典型用法代码示例。如果您正苦于以下问题:Java Envelope.getMaximum方法的具体用法?Java Envelope.getMaximum怎么用?Java Envelope.getMaximum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.geometry.Envelope
的用法示例。
在下文中一共展示了Envelope.getMaximum方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBoundaryProduct
import org.opengis.geometry.Envelope; //导入方法依赖的package包/类
public Product getBoundaryProduct() throws FactoryException, TransformException {
final CoordinateReferenceSystem mapCRS = getTargetCRS();
if (mapCRS != null) {
final ReferencedEnvelope envelope = getTargetEnvelope();
final Envelope mapEnvelope = envelope.transform(mapCRS, true);
final double pixelSizeX = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_X);
final double pixelSizeY = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_Y);
final int w = MathUtils.floorInt(mapEnvelope.getSpan(0) / pixelSizeX);
final int h = MathUtils.floorInt(mapEnvelope.getSpan(1) / pixelSizeY);
final Product product = new Product("mosaic", "MosaicBounds", w, h);
final GeoCoding geoCoding = new CrsGeoCoding(mapCRS,
w, h,
mapEnvelope.getMinimum(0),
mapEnvelope.getMaximum(1),
pixelSizeX, pixelSizeY);
product.setSceneGeoCoding(geoCoding);
return product;
}
return null;
}
示例2: getReferenceEnvelope
import org.opengis.geometry.Envelope; //导入方法依赖的package包/类
public static ReferencedEnvelope getReferenceEnvelope(
final GridCoverage gridCoverage,
final CoordinateReferenceSystem targetCrs ) {
final CoordinateReferenceSystem sourceCrs = gridCoverage.getCoordinateReferenceSystem();
final Envelope sampleEnvelope = gridCoverage.getEnvelope();
final ReferencedEnvelope sampleReferencedEnvelope = new ReferencedEnvelope(
new com.vividsolutions.jts.geom.Envelope(
sampleEnvelope.getMinimum(0),
sampleEnvelope.getMaximum(0),
sampleEnvelope.getMinimum(1),
sampleEnvelope.getMaximum(1)),
gridCoverage.getCoordinateReferenceSystem());
ReferencedEnvelope projectedReferenceEnvelope = sampleReferencedEnvelope;
if ((targetCrs != null) && !targetCrs.equals(sourceCrs)) {
try {
projectedReferenceEnvelope = sampleReferencedEnvelope.transform(
targetCrs,
true);
}
catch (TransformException | FactoryException e) {
LOGGER.warn(
"Unable to transform envelope of grid coverage to " + targetCrs.getName(),
e);
}
}
return projectedReferenceEnvelope;
}
示例3: createWritableSerializer
import org.opengis.geometry.Envelope; //导入方法依赖的package包/类
@Override
public HadoopWritableSerializer<GridCoverage, GridCoverageWritable> createWritableSerializer() {
return new HadoopWritableSerializer<GridCoverage, GridCoverageWritable>() {
@Override
public GridCoverageWritable toWritable(
final GridCoverage entry ) {
final Envelope env = entry.getEnvelope();
final DataBuffer dataBuffer = entry.getRenderedImage().copyData(
new InternalWritableRaster(
sampleModel.createCompatibleSampleModel(
tileSize,
tileSize),
new Point())).getDataBuffer();
Persistable metadata = null;
if (entry instanceof GridCoverage2D) {
final Object metadataObj = ((GridCoverage2D) entry).getProperty(TILE_METADATA_PROPERTY_KEY);
if ((metadataObj != null) && (metadataObj instanceof Persistable)) {
metadata = (Persistable) metadataObj;
}
}
return new GridCoverageWritable(
new RasterTile(
dataBuffer,
metadata),
env.getMinimum(0),
env.getMaximum(0),
env.getMinimum(1),
env.getMaximum(1));
}
@Override
public GridCoverage fromWritable(
final GridCoverageWritable writable ) {
final ReferencedEnvelope mapExtent = new ReferencedEnvelope(
writable.getMinX(),
writable.getMaxX(),
writable.getMinY(),
writable.getMaxY(),
GeoWaveGTRasterFormat.DEFAULT_CRS);
try {
return prepareCoverage(
writable.getRasterTile(),
tileSize,
mapExtent);
}
catch (final IOException e) {
LOGGER.error(
"Unable to read raster data",
e);
}
return null;
}
};
}
示例4: getBoundaryProduct
import org.opengis.geometry.Envelope; //导入方法依赖的package包/类
public Product getBoundaryProduct() throws FactoryException, TransformException {
final CoordinateReferenceSystem mapCRS = getTargetCRS();
if (mapCRS != null) {
final ReferencedEnvelope envelope = getTargetEnvelope();
final Envelope mapEnvelope = envelope.transform(mapCRS, true);
final double pixelSizeX = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_X);
final double pixelSizeY = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_Y);
final int w = MathUtils.floorInt(mapEnvelope.getSpan(0) / pixelSizeX);
final int h = MathUtils.floorInt(mapEnvelope.getSpan(1) / pixelSizeY);
final Product product = new Product("Multi-seize Mosaic", "MosaicBounds", w, h);
final GeoCoding geoCoding = new CrsGeoCoding(mapCRS,
w, h,
mapEnvelope.getMinimum(0),
mapEnvelope.getMaximum(1),
pixelSizeX, pixelSizeY);
product.setSceneGeoCoding(geoCoding);
return product;
}
return null;
}
示例5: calcAreaOfCell
import org.opengis.geometry.Envelope; //导入方法依赖的package包/类
private double calcAreaOfCell(GridGeometry2D geom) {
GridEnvelope gridRange = geom.getGridRange();
int width = gridRange.getHigh(0) - gridRange.getLow(0) + 1; // allow for the
int height = gridRange.getHigh(1) - gridRange.getLow(1) + 1;// 0th row/col
Envelope envelope = geom.getEnvelope();
double dWidth = envelope.getMaximum(0) - envelope.getMinimum(0);
double dHeight = envelope.getMaximum(1) - envelope.getMinimum(1);
double cellWidth = dWidth / width;
double cellHeight = dHeight / height;
return cellWidth * cellHeight;
}
示例6: BoundingBoxImpl
import org.opengis.geometry.Envelope; //导入方法依赖的package包/类
/**
* Creates a {@link BoundingBox} from a {@link CoordinateReferenceSystem},
* where the bounds are the limits of validity of the CRS
*
* @param crs
*/
public BoundingBoxImpl(CoordinateReferenceSystem crs) {
//
// TODO: replace the code below by the following block after Apache SIS 0.8 release:
//
// Envelope envelope = CRS.getDomainOfValidity(crs);
//
Envelope envelope = null;
final GeographicBoundingBox bbox = CRS.getGeographicBoundingBox(crs);
if (bbox != null && !Boolean.FALSE.equals(bbox.getInclusion())) {
final SingleCRS targetCRS = CRS.getHorizontalComponent(crs);
GeographicCRS sourceCRS = ReferencingUtilities.toNormalizedGeographicCRS(targetCRS);
if (sourceCRS != null) {
GeneralEnvelope bounds = new GeneralEnvelope(bbox);
bounds.translate(-CRS.getGreenwichLongitude(sourceCRS), 0);
bounds.setCoordinateReferenceSystem(sourceCRS);
try {
envelope = Envelopes.transform(bounds, targetCRS);
} catch (TransformException e) {
throw new IllegalArgumentException(e);
}
}
}
// End of TODO block
if (envelope == null) {
throw new IllegalArgumentException(
"The given CRS does not specify a domain of validity.");
}
this.minx = envelope.getMinimum(0);
this.maxx = envelope.getMaximum(0);
this.miny = envelope.getMinimum(1);
this.maxy = envelope.getMaximum(1);
this.crs = crs;
}
示例7: createHDR
import org.opengis.geometry.Envelope; //导入方法依赖的package包/类
private synchronized void createHDR(String filename,Envelope bounds) {
/*
BYTEORDER M
LAYOUT BIL
NROWS 6000
NCOLS 4800
NBANDS 1
NBITS 16
BANDROWBYTES 9600
TOTALROWBYTES 9600
BANDGAPBYTES 0
NODATA -9999
ULXMAP -140.0
ULYMAP 40.0
XDIM 0.00833333333333
YDIM 0.00833333333333
*/
double lat = bounds.getMaximum(0);
double lon = bounds.getMinimum(1);
int nrows, ncols;
if(lat > -60 ) {
ncols = 4800;
nrows = 6000;
} else {
// Antarctic latitudes
ncols = 7200;
nrows = 3600;
}
double grid = 50./6000;
if(cache.isAvailable(filename)) {
// Don't replace existing file
return;
}
log.info("Creating "+filename);
StringBuilder contents = new StringBuilder();
String eol = System.getProperty("line.separator");
contents.append("BYTEORDER M"+eol);
contents.append("LAYOUT BIL"+eol);
contents.append("NROWS "+nrows+eol);
contents.append("NCOLS "+ncols+eol);
contents.append("NBANDS 1"+eol);
contents.append("NBITS 16"+eol);
contents.append("BANDROWBYTES "+(ncols*2)+eol);
contents.append("TOTALROWBYTES "+(ncols*2)+eol);
contents.append("BANDGAPBYTES 0"+eol);
contents.append("NODATA -9999"+eol);
// Storing floats as strings is always problematic. Err a bit on the safe
// side by subtracting 1e-14, since nice round numbers are used more than
// their slightly smaller counterparts.
// TODO Needs an actual fix
contents.append("ULXMAP "+(lon+grid/2-1e-13)+eol);
contents.append("ULYMAP "+(lat-grid/2+1e-13)+eol);
contents.append("XDIM "+grid+eol);
contents.append("YDIM "+grid+eol);
InputStream in = new ByteArrayInputStream(contents.toString().getBytes());
cache.prefetch(filename, in);
}