本文整理了Java中org.esa.beam.framework.datamodel.GeoCoding.getMapCRS()
方法的一些代码示例,展示了GeoCoding.getMapCRS()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoCoding.getMapCRS()
方法的具体详情如下:
包路径:org.esa.beam.framework.datamodel.GeoCoding
类名称:GeoCoding
方法名:getMapCRS
暂无
代码示例来源:origin: bcdev/beam
@Override
public CoordinateReferenceSystem getMapCRS() {
return geoCoding.getMapCRS();
}
代码示例来源:origin: bcdev/beam
static boolean isGeographicCRS(final GeoCoding geoCoding) {
return (geoCoding instanceof CrsGeoCoding || geoCoding instanceof MapGeoCoding) &&
CRS.equalsIgnoreMetadata(geoCoding.getMapCRS(), DefaultGeographicCRS.WGS84);
}
代码示例来源:origin: bcdev/beam
private CoordinateReferenceSystem getMapCrs() {
return product.getGeoCoding().getMapCRS();
}
代码示例来源:origin: bcdev/beam
protected String getCSName(final RasterDataNode raster) {
final String csName;
final GeoCoding geoCoding = raster.getGeoCoding();
if (geoCoding instanceof MapGeoCoding || geoCoding instanceof CrsGeoCoding) {
csName = geoCoding.getMapCRS().getName().toString();
} else {
csName = "Satellite coordinates";
}
return csName;
}
代码示例来源:origin: bcdev/beam
@Override
public CoordinateReferenceSystem getCRS(GeoPos referencePos) {
Product collocationProduct = collocateProductSelector.getSelectedProduct();
if (collocationProduct != null) {
return collocationProduct.getGeoCoding().getMapCRS();
}
return null;
}
代码示例来源:origin: bcdev/beam
@Override
public CoordinateReferenceSystem getCRS(GeoPos referencePos) {
Product collocationProduct = collocateProductSelector.getSelectedProduct();
if (collocationProduct != null) {
return collocationProduct.getGeoCoding().getMapCRS();
}
return null;
}
代码示例来源:origin: bcdev/beam
/**
* Gets the coordinate reference system used for the model space. The model space is coordinate system
* that is used to render images for display.
*
* @param geoCoding A geo-coding, may be {@code null}.
* @return The coordinate reference system used for the model space. If {@code geoCoding} is {@code null},
* it will be a default image coordinate reference system (an instance of {@code org.opengis.referencing.crs.ImageCRS}).
*/
public static CoordinateReferenceSystem getModelCrs(GeoCoding geoCoding) {
if (geoCoding != null) {
final MathTransform image2Map = geoCoding.getImageToMapTransform();
if (image2Map instanceof AffineTransform) {
return geoCoding.getMapCRS();
}
return geoCoding.getImageCRS();
} else {
return DEFAULT_IMAGE_CRS;
}
}
代码示例来源:origin: bcdev/beam
void setUpdateProduct(Product product) {
setPropertyValue(PROPERTY_UPDATE_PRODUCT, product);
if (product != null && product.getGeoCoding() != null && product.getGeoCoding().getMapCRS() != null) {
setTargetCRS(product.getGeoCoding().getMapCRS().toWKT());
}
}
代码示例来源:origin: bcdev/beam
public static GeoTIFFMetadata createGeoTIFFMetadata(GeoCoding geoCoding, int width, int height) {
GeoTIFFMetadata metadata = null;
if (geoCoding instanceof CrsGeoCoding || geoCoding instanceof MapGeoCoding) {
metadata = createProjectedGeoTIFFMetadata(geoCoding.getMapCRS(), geoCoding.getImageToMapTransform());
} else if (geoCoding != null) {
metadata = createFallbackGeoTIFFMetada(geoCoding, width, height);
}
return metadata;
}
代码示例来源:origin: bcdev/beam
private void updateInfoPanel(AbstractTimeSeries timeSeries) {
if (timeSeries == null) {
nameField.setVisible(false);
crsField.setVisible(false);
startField.setVisible(false);
endField.setVisible(false);
dimensionField.setVisible(false);
return;
}
final Product tsProduct = timeSeries.getTsProduct();
nameField.setText(tsProduct.getDisplayName());
crsField.setText(tsProduct.getGeoCoding().getMapCRS().getName().getCode());
final String startTime = dateFormat.format(tsProduct.getStartTime().getAsDate());
startField.setText(startTime);
String endTime = dateFormat.format(tsProduct.getEndTime().getAsDate());
endField.setText(endTime);
final String dimensionString = tsProduct.getSceneRasterWidth() + " x " + tsProduct.getSceneRasterHeight();
dimensionField.setText(dimensionString);
}
代码示例来源:origin: bcdev/beam
private boolean isGeographicLatLon(GeoCoding geoCoding) {
if (geoCoding instanceof MapGeoCoding) {
MapGeoCoding mapGeoCoding = (MapGeoCoding) geoCoding;
MapTransformDescriptor transformDescriptor = mapGeoCoding.getMapInfo()
.getMapProjection().getMapTransform().getDescriptor();
String typeID = transformDescriptor.getTypeID();
if (typeID.equals(IdentityTransformDescriptor.TYPE_ID)) {
return true;
}
} else if (geoCoding instanceof CrsGeoCoding) {
return CRS.equalsIgnoreMetadata(geoCoding.getMapCRS(), DefaultGeographicCRS.WGS84);
}
return false;
}
代码示例来源:origin: bcdev/beam
private static FeatureCollection<SimpleFeatureType, SimpleFeature> transformPixelPosToGeoPos(FeatureCollection<SimpleFeatureType, SimpleFeature> fc, GeoCoding geoCoding) {
Iterator<SimpleFeature> iterator = fc.iterator();
FeatureCollection<SimpleFeatureType, SimpleFeature> transformedFc = new DefaultFeatureCollection(fc.getID(), fc.getSchema());
while (iterator.hasNext()) {
SimpleFeature sourceFeature = iterator.next();
Geometry geometry = (Geometry) sourceFeature.getDefaultGeometry();
GeometryCoordinateSequenceTransformer transformer = new GeometryCoordinateSequenceTransformer();
transformer.setMathTransform(geoCoding.getImageToMapTransform());
transformer.setCoordinateReferenceSystem(geoCoding.getMapCRS());
try {
geometry = transformer.transform(geometry);
} catch (TransformException e) {
throw new IllegalStateException(e);
}
sourceFeature.setDefaultGeometry(geometry);
transformedFc.add(sourceFeature);
}
return transformedFc;
}
}
代码示例来源:origin: bcdev/beam
private void addWktAsVariable(NFileWriteable ncFile, GeoCoding geoCoding) throws IOException {
final CoordinateReferenceSystem crs = geoCoding.getMapCRS();
final double[] matrix = new double[6];
final MathTransform transform = geoCoding.getImageToMapTransform();
if (transform instanceof AffineTransform) {
((AffineTransform) transform).getMatrix(matrix);
}
final NVariable crsVariable = ncFile.addScalarVariable("crs", DataType.INT);
crsVariable.addAttribute("wkt", crs.toWKT());
crsVariable.addAttribute("i2m", StringUtils.arrayToCsv(matrix));
}
}
代码示例来源:origin: bcdev/beam
private ObservationIterator(Product product, SamplePointer pointer, BinningContext binningContext) {
this.pointer = pointer;
this.dataPeriod = binningContext.getDataPeriod();
Geometry geometryRegion = binningContext.getRegion();
if (geometryRegion != null) {
this.region = PreparedGeometryFactory.prepare(binningContext.getRegion());
} else {
this.region = null;
}
this.product = product;
this.productHasTime = product.getStartTime() != null || product.getEndTime() != null;
this.gc = product.getGeoCoding();
Ellipsoid ellipsoid = CRS.getEllipsoid(gc.getMapCRS());
earthRadius = ellipsoid != null ? ellipsoid.getSemiMajorAxis() : DefaultEllipsoid.WGS84.getSemiMajorAxis();
geometryFactory = new GeometryFactory();
maxDistanceOnEarth = binningContext.getMaxDistanceOnEarth();
}
代码示例来源:origin: bcdev/beam
@Override
public void actionPerformed(CommandEvent event) {
ProductSceneView view = VisatApp.getApp().getSelectedProductSceneView();
final GeoCoding geoCoding = view.getProduct().getGeoCoding();
boolean isGeographic = false;
if (geoCoding instanceof MapGeoCoding) {
MapGeoCoding mapGeoCoding = (MapGeoCoding) geoCoding;
MapTransformDescriptor transformDescriptor = mapGeoCoding.getMapInfo()
.getMapProjection().getMapTransform().getDescriptor();
String typeID = transformDescriptor.getTypeID();
if (typeID.equals(IdentityTransformDescriptor.TYPE_ID)) {
isGeographic = true;
}
} else if(geoCoding instanceof CrsGeoCoding){
isGeographic = CRS.equalsIgnoreMetadata(geoCoding.getMapCRS(), DefaultGeographicCRS.WGS84);
}
if(isGeographic) {
exportImage(view);
}else {
String message = "Product must be in ''Geographic Lat/Lon'' projection.";
VisatApp.getApp().showInfoDialog(message, null);
}
}
代码示例来源:origin: bcdev/beam
private void resetGeolocTableModel() {
geolocModel.clear();
if (currentRaster != null) {
final GeoCoding geoCoding = currentRaster.getGeoCoding();
geolocModel.addRow("Image-X", "", "pixel");
geolocModel.addRow("Image-Y", "", "pixel");
if (geoCoding != null) {
geolocModel.addRow("Longitude", "", "degree");
geolocModel.addRow("Latitude", "", "degree");
if (geoCoding instanceof MapGeoCoding) {
final MapGeoCoding mapGeoCoding = (MapGeoCoding) geoCoding;
final String mapUnit = mapGeoCoding.getMapInfo().getMapProjection().getMapUnit();
geolocModel.addRow("Map-X", "", mapUnit);
geolocModel.addRow("Map-Y", "", mapUnit);
} else if (geoCoding instanceof CrsGeoCoding) {
String xAxisUnit = geoCoding.getMapCRS().getCoordinateSystem().getAxis(0).getUnit().toString();
String yAxisUnit = geoCoding.getMapCRS().getCoordinateSystem().getAxis(1).getUnit().toString();
geolocModel.addRow("Map-X", "", xAxisUnit);
geolocModel.addRow("Map-Y", "", yAxisUnit);
}
}
}
}
代码示例来源:origin: bcdev/beam
@Test
public void testTransferGeoCodingWithSubset_Region() {
final ProductSubsetDef subsetDef = new ProductSubsetDef("subset");
subsetDef.setRegion(2, 2, 4, 4);
final boolean transfered = srcScene.transferGeoCodingTo(destScene, subsetDef);
assertTrue(transfered);
final GeoCoding destGeoCoding = destScene.getGeoCoding();
assertNotNull(destGeoCoding);
assertNotSame(srcGeoCoding, destGeoCoding);
assertEquals(srcGeoCoding.getDatum(), destGeoCoding.getDatum());
assertEquals(srcGeoCoding.getMapCRS(), destGeoCoding.getMapCRS());
// position (3,3) in source equals (1,1) in dest
comparePixelPos(destGeoCoding, new PixelPos(3, 3), new PixelPos(1, 1));
}
代码示例来源:origin: bcdev/beam
@Test
public void testTransferGeoCodingWithoutSubset() {
final boolean returnValue = srcScene.transferGeoCodingTo(destScene, null);
assertTrue(returnValue);
final GeoCoding destGeoCoding = destScene.getGeoCoding();
assertNotNull(destGeoCoding);
assertNotSame(srcGeoCoding, destGeoCoding);
assertEquals(srcGeoCoding.getDatum(), destGeoCoding.getDatum());
assertEquals(srcGeoCoding.getMapCRS(), destGeoCoding.getMapCRS());
assertEquals(srcGeoCoding.getGeoCRS(), destGeoCoding.getGeoCRS());
assertEquals(srcGeoCoding.getGeoPos(new PixelPos(3.5f, 0.5f), null),
destGeoCoding.getGeoPos(new PixelPos(3.5f, 0.5f), null));
}
代码示例来源:origin: bcdev/beam
@Test
public void testTransferGeoCodingWithSubset_Subsampling() {
final ProductSubsetDef subsetDef = new ProductSubsetDef("subset");
subsetDef.setSubSampling(2, 4);
final boolean transfered = srcScene.transferGeoCodingTo(destScene, subsetDef);
assertTrue(transfered);
final GeoCoding destGeoCoding = destScene.getGeoCoding();
assertNotNull(destGeoCoding);
assertNotSame(srcGeoCoding, destGeoCoding);
assertEquals(srcGeoCoding.getDatum(), destGeoCoding.getDatum());
assertEquals(srcGeoCoding.getMapCRS(), destGeoCoding.getMapCRS());
assertEquals(srcGeoCoding.getGeoCRS(), destGeoCoding.getGeoCRS());
comparePixelPos(destGeoCoding, new PixelPos(0, 0), new PixelPos(0, 0));
comparePixelPos(destGeoCoding, new PixelPos(8, 0), new PixelPos(4, 0));
comparePixelPos(destGeoCoding, new PixelPos(8, 16), new PixelPos(4, 4));
comparePixelPos(destGeoCoding, new PixelPos(0, 16), new PixelPos(0, 4));
}
代码示例来源:origin: bcdev/beam
@Test
public void testTransferGeoCodingWithSubset_SubsamplingAndRegion() {
final ProductSubsetDef subsetDef = new ProductSubsetDef("subset");
subsetDef.setRegion(2, 2, 8, 8);
subsetDef.setSubSampling(2, 2);
final boolean transfered = srcScene.transferGeoCodingTo(destScene, subsetDef);
assertTrue(transfered);
final GeoCoding destGeoCoding = destScene.getGeoCoding();
assertNotNull(destGeoCoding);
assertNotSame(srcGeoCoding, destGeoCoding);
assertEquals(srcGeoCoding.getDatum(), destGeoCoding.getDatum());
assertEquals(srcGeoCoding.getMapCRS(), destGeoCoding.getMapCRS());
assertEquals(srcGeoCoding.getGeoCRS(), destGeoCoding.getGeoCRS());
comparePixelPos(destGeoCoding, new PixelPos(2, 2), new PixelPos(0, 0));
comparePixelPos(destGeoCoding, new PixelPos(10, 2), new PixelPos(4, 0));
comparePixelPos(destGeoCoding, new PixelPos(10, 10), new PixelPos(4, 4));
comparePixelPos(destGeoCoding, new PixelPos(2, 10), new PixelPos(0, 4));
}
内容来源于网络,如有侵权,请联系作者删除!