本文整理了Java中org.esa.snap.core.datamodel.GeoCoding
类的一些代码示例,展示了GeoCoding
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoCoding
类的具体详情如下:
包路径:org.esa.snap.core.datamodel.GeoCoding
类名称:GeoCoding
暂无
代码示例来源:origin: senbox-org/s2tbx
private GeoPos getCenterGeoPos(GeoCoding geoCoding, int width, int height) {
final PixelPos centerPixelPos = new PixelPos(0.5 * width + 0.5,
0.5 * height + 0.5);
return geoCoding.getGeoPos(centerPixelPos, null);
}
代码示例来源:origin: senbox-org/snap-desktop
private CoordinateReferenceSystem getMapCrs() {
return product.getSceneGeoCoding().getMapCRS();
}
代码示例来源:origin: senbox-org/s1tbx
private static boolean pixelPosValid(final GeoCoding geoCoding, final GeoPos geoPos, final PixelPos pixelPos,
final int width, final int height) {
geoCoding.getPixelPos(geoPos, pixelPos);
return (pixelPos.isValid() && pixelPos.x >= 0 && pixelPos.x < width &&
pixelPos.y >= 0 && pixelPos.y < height);
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public boolean accept(Product product) {
final GeoCoding geoCoding = product.getSceneGeoCoding();
return geoCoding != null && geoCoding.canGetGeoPos() && geoCoding.canGetPixelPos();
}
}
代码示例来源:origin: senbox-org/s2tbx
/**
* Utility methods
*/
private double[] getPixelSize(GeoCoding sourceGeoCoding, CoordinateReferenceSystem targetCRS) {
double[] size = null;
try {
size = new double[2];
DirectPosition geoPos1 = sourceGeoCoding.getImageToMapTransform()
.transform(new DirectPosition2D(0, 0), null);
Coordinate c1 = new Coordinate(geoPos1.getOrdinate(0), geoPos1.getOrdinate(1));
DirectPosition geoPos2 = sourceGeoCoding.getImageToMapTransform()
.transform(new DirectPosition2D(0, 1), null);
Coordinate c2 = new Coordinate(geoPos2.getOrdinate(0), geoPos2.getOrdinate(1));
DirectPosition geoPos3 = sourceGeoCoding.getImageToMapTransform()
.transform(new DirectPosition2D(1, 0), null);
Coordinate c3 = new Coordinate(geoPos3.getOrdinate(0), geoPos3.getOrdinate(1));
final CoordinateReferenceSystem sourceCRS = sourceGeoCoding.getMapCRS();
size[0] = distance(sourceCRS, targetCRS, c3, c1);
size[1] = distance(sourceCRS, targetCRS, c2, c1);
} catch (TransformException tex) {
tex.printStackTrace();
}
return size;
}
代码示例来源:origin: senbox-org/snap-desktop
if (thisGeoCoding != null && thatGeoCoding != null && thisGeoCoding.canGetGeoPos() && thatGeoCoding.canGetPixelPos()) {
final Viewport thisViewport = layerCanvas.getViewport();
final Viewport thatViewport = thatView.layerCanvas.getViewport();
getBaseImageLayer().getModelToImageTransform().transform(modelCenter, imageCenter);
final GeoPos geoCenter = new GeoPos();
thisGeoCoding.getGeoPos(imageCenter, geoCenter);
thatGeoCoding.getPixelPos(geoCenter, imageCenter);
if (imageCenter.isValid()) {
thatView.getBaseImageLayer().getImageToModelTransform().transform(imageCenter, modelCenter);
代码示例来源:origin: senbox-org/s2tbx
if (geoCoding instanceof CrsGeoCoding) {
try {
final Integer epsgCode = CRS.lookupEpsgCode(geoCoding.getMapCRS(), true);
GmlRectifiedGrid rectifiedGrid = new GmlRectifiedGrid();
rectifiedGrid.setEpsgNumber(epsgCode);
GmlEnvelope<Double> gmlEnvelope = new GmlEnvelope<>(geoCoding.getGeoPos(new PixelPos(0, 0), null).getLat(),
geoCoding.getGeoPos(new PixelPos(0, 0), null).getLon(),
geoCoding.getGeoPos(new PixelPos(width - 1, height - 1), null).getLat(),
geoCoding.getGeoPos(new PixelPos(width - 1, height - 1), null).getLon(),
"Envelope");
gmlEnvelope.setPolygonCorners(geoCoding.getGeoPos(new PixelPos(0, 0), null).getLat(),
geoCoding.getGeoPos(new PixelPos(0, 0), null).getLon(),
geoCoding.getGeoPos(new PixelPos(width, 0), null).getLat(),
geoCoding.getGeoPos(new PixelPos(width, 0), null).getLon(),
geoCoding.getGeoPos(new PixelPos(width, height), null).getLat(),
geoCoding.getGeoPos(new PixelPos(width, height), null).getLon(),
geoCoding.getGeoPos(new PixelPos(0, height), null).getLat(),
geoCoding.getGeoPos(new PixelPos(0, height), null).getLon());
gmlEnvelope.setPolygonUse(true);
this.metadata.setEnvelope(gmlEnvelope);
代码示例来源:origin: senbox-org/snap-desktop
GeoPos geoPos = geoCoding.getGeoPos(pixelPos, null);
if (pixelInfoView.getShowGeoPosDecimals()) {
tgx = String.format("%.6f", geoPos.getLon());
tmy = String.valueOf(MathUtils.round(mapPoint.getY(), 10000.0));
} else if (geoCoding instanceof CrsGeoCoding) {
MathTransform transform = geoCoding.getImageToMapTransform();
try {
DirectPosition position = transform.transform(new DirectPosition2D(pX, pY), null);
代码示例来源:origin: senbox-org/snap-desktop
GeoPos gp = new GeoPos();
gp = geoCoding.getGeoPos(sceneCenter, gp);
gp = geoCoding.getGeoPos(sceneUpperLeft, gp);
addRow("Upper left latitude", gp.getLatString());
addRow("Upper left longitude", gp.getLonString());
gp = geoCoding.getGeoPos(sceneUpperRight, gp);
addRow("Upper right latitude", gp.getLatString());
addRow("Upper right longitude", gp.getLonString());
gp = geoCoding.getGeoPos(sceneLowerLeft, gp);
addRow("Lower left latitude", gp.getLatString());
addRow("Lower left longitude", gp.getLonString());
gp = geoCoding.getGeoPos(sceneLowerRight, gp);
addRow("Lower right latitude", gp.getLatString());
addRow("Lower right longitude", gp.getLonString());
addRowWithTextField("WKT of the image CRS", geoCoding.getImageCRS().toString());
addRowWithTextField("WKT of the geographical CRS", geoCoding.getGeoCRS().toString());
代码示例来源:origin: senbox-org/snap-desktop
if (geoCoding.canGetGeoPos()) {
final PixelPos pixelPos = new PixelPos(imagePosX, imagePosY);
geoCoding.getGeoPos(pixelPos, geoPos);
} else {
geoPos.setInvalid();
代码示例来源:origin: senbox-org/snap-desktop
for (float[] offset : OFFSETS) {
pixelPos1.setLocation(x + offset[0], y + offset[1]);
product.getSceneGeoCoding().getGeoPos(pixelPos1, geoPos);
product.getSceneGeoCoding().getPixelPos(geoPos, pixelPos2);
double dx = pixelPos2.x - pixelPos1.x;
double dy = pixelPos2.y - pixelPos1.y;
代码示例来源:origin: senbox-org/snap-desktop
final PixelPos lowerRightPP = new PixelPos(product.getSceneRasterWidth(),
product.getSceneRasterHeight());
final GeoPos upperLeftGP = geoCoding.getGeoPos(upperLeftPP, null);
final GeoPos lowerRightGP = geoCoding.getGeoPos(lowerRightPP, null);
double eastLon = lowerRightGP.getLon();
if (geoCoding.isCrossingMeridianAt180()) {
eastLon += 360;
代码示例来源:origin: senbox-org/s2tbx
private double determineSourceResolution() throws OperatorException {
final GeoCoding sceneGeoCoding = getSourceProduct().getSceneGeoCoding();
if (sceneGeoCoding instanceof CrsGeoCoding) {
final MathTransform imageToMapTransform = sceneGeoCoding.getImageToMapTransform();
if (imageToMapTransform instanceof AffineTransform) {
return ((AffineTransform) imageToMapTransform).getScaleX();
}
}
throw new OperatorException("Invalid product: ");
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public void paintOverlay(LayerCanvas canvas, Rendering rendering) {
if (geoPosition == null || !geoPosition.isValid()) {
return;
}
final GeoCoding geoCoding = sceneView.getRaster().getGeoCoding();
if (!geoCoding.canGetPixelPos()) {
return;
}
final Product product = sceneView.getRaster().getProduct();
final PixelPos pixelPos = geoCoding.getPixelPos(geoPosition, null);
if (!pixelPos.isValid() || !product.containsPixel(pixelPos)) {
return;
}
final Viewport viewport = canvas.getViewport();
drawCursor(rendering.getGraphics(), viewport, pixelPos);
}
代码示例来源:origin: senbox-org/s2tbx
double y = pol.getCoordinates()[index].y;
try {
DirectPosition pos = CRS.findMathTransform(product.getSceneGeoCoding().getMapCRS(), product.getSceneGeoCoding().getImageCRS()).transform(new DirectPosition2D(x, y), null);
double[] values = pos.getCoordinate();
xCoordinates[index] = (int) values[0];
代码示例来源:origin: senbox-org/snap-desktop
private static boolean intersectsWith(Product sourceProduct, Product targetProduct) {
final GeoCoding srcGC = sourceProduct.getSceneGeoCoding();
final GeoCoding targetGC = targetProduct.getSceneGeoCoding();
if (srcGC != null && srcGC.canGetGeoPos() && targetGC != null && targetGC.canGetGeoPos()) {
final GeneralPath[] sourcePath = ProductUtils.createGeoBoundaryPaths(sourceProduct);
final GeneralPath[] targetPath = ProductUtils.createGeoBoundaryPaths(targetProduct);
for (GeneralPath spath : sourcePath) {
Rectangle bounds = spath.getBounds();
for (GeneralPath tPath : targetPath) {
if (tPath.getBounds().intersects(bounds)) {
return true;
}
}
}
}
return false;
}
}
代码示例来源:origin: senbox-org/snap-desktop
private boolean canUseGeoCoordinates(Product product) {
final GeoCoding geoCoding = product.getSceneGeoCoding();
return geoCoding != null && geoCoding.canGetPixelPos() && geoCoding.canGetGeoPos();
}
代码示例来源:origin: senbox-org/s2tbx
double scaleY = (double) sourceProduct.getSceneRasterHeight() / referenceHeight;
GeoCoding sceneGeoCoding = sourceProduct.getSceneGeoCoding();
if (sceneGeoCoding != null && sceneGeoCoding.getImageToMapTransform() instanceof AffineTransform) {
AffineTransform mapTransform = (AffineTransform) sceneGeoCoding.getImageToMapTransform();
referenceImageToModelTransform =
new AffineTransform(scaleX * mapTransform.getScaleX(), 0, 0, scaleY * mapTransform.getScaleY(),
final MathTransform imageToMapTransform = sourceProduct.getSceneGeoCoding().getImageToMapTransform();
if (imageToMapTransform instanceof AffineTransform) {
AffineTransform mapTransform = (AffineTransform) imageToMapTransform;
代码示例来源:origin: senbox-org/s1tbx
if (sourceProducts[0].getSceneGeoCoding() != null && sourceProducts[0].getSceneGeoCoding().canGetGeoPos()) {
masterProduct = sourceProducts[0];
slaveProduct = sourceProducts[1];
} else if (sourceProducts[1].getSceneGeoCoding() != null && sourceProducts[1].getSceneGeoCoding().canGetGeoPos()) {
masterProduct = sourceProducts[1];
slaveProduct = sourceProducts[0];
代码示例来源:origin: senbox-org/s2tbx
private float[] getLatLon(int iX, int iY, Rectangle pixelWindow, Product sourceProduct) {
float xOffset = ((iX + 0.5f) * pixelWindow.width + pixelWindow.x);
float yOffset = ((iY + 0.5f) * pixelWindow.height + pixelWindow.y);
GeoCoding geoCoding = sourceProduct.getSceneGeoCoding();
GeoPos geoPos = geoCoding.getGeoPos(new PixelPos(xOffset, yOffset), null);
return new float[]{(float) geoPos.lat, (float) geoPos.lon};
}
内容来源于网络,如有侵权,请联系作者删除!