本文整理了Java中org.esa.beam.framework.datamodel.GeoCoding.getImageCRS()
方法的一些代码示例,展示了GeoCoding.getImageCRS()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoCoding.getImageCRS()
方法的具体详情如下:
包路径:org.esa.beam.framework.datamodel.GeoCoding
类名称:GeoCoding
方法名:getImageCRS
暂无
代码示例来源: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
sb.append(geoCoding.getImageCRS().toString());
sb.append("\n");
sb.append("Well-known text format (WKT) of the geographical CRS:\n\n");
代码示例来源:origin: bcdev/beam
private static Rectangle2D createMapBoundary(final Product product, CoordinateReferenceSystem targetCrs) {
try {
final CoordinateReferenceSystem sourceCrs = product.getGeoCoding().getImageCRS();
final int sourceW = product.getSceneRasterWidth();
final int sourceH = product.getSceneRasterHeight();
final Rectangle2D rect = XRectangle2D.createFromExtremums(0.5, 0.5, sourceW - 0.5, sourceH - 0.5);
int pointsPerSide = Math.max(sourceH, sourceW) / 10;
pointsPerSide = Math.max(9, pointsPerSide);
final ReferencedEnvelope sourceEnvelope = new ReferencedEnvelope(rect, sourceCrs);
final ReferencedEnvelope targetEnvelope = sourceEnvelope.transform(targetCrs, true, pointsPerSide);
double minX = targetEnvelope.getMinX();
double width = targetEnvelope.getWidth();
if (product.getGeoCoding().isCrossingMeridianAt180()) {
minX = -180.0;
width = 360;
}
return new Rectangle2D.Double(minX, targetEnvelope.getMinY(), width, targetEnvelope.getHeight());
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
代码示例来源:origin: bcdev/beam
private static SimpleFeatureType createTrackFeatureType(GeoCoding geoCoding) {
SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder();
ftb.setName("org.esa.beam.TrackPoint");
/*0*/
ftb.add("pixelPos", Point.class, geoCoding.getImageCRS());
/*1*/
ftb.add("geoPos", Point.class, DefaultGeographicCRS.WGS84);
/*2*/
ftb.add("data", Double.class);
ftb.setDefaultGeometry(geoCoding instanceof CrsGeoCoding ? "geoPos" : "pixelPos");
// GeoTools Bug: this doesn't work
// ftb.userData("trackPoints", "true");
final SimpleFeatureType ft = ftb.buildFeatureType();
ft.getUserData().put("trackPoints", "true");
return ft;
}
代码示例来源:origin: bcdev/beam
private static Map<Class<?>, List<SimpleFeature>> createGeometryToFeaturesListMap(VectorDataNode vectorNode) {
FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = vectorNode.getFeatureCollection();
CoordinateReferenceSystem crs = vectorNode.getFeatureType().getCoordinateReferenceSystem();
if (crs == null) { // for pins and GCPs crs is null --> assume image crs
crs = vectorNode.getProduct().getGeoCoding().getImageCRS();
}
final CoordinateReferenceSystem modelCrs;
if (vectorNode.getProduct().getGeoCoding() instanceof CrsGeoCoding) {
modelCrs = ImageManager.getModelCrs(vectorNode.getProduct().getGeoCoding());
} else {
modelCrs = DefaultGeographicCRS.WGS84;
}
if (!CRS.equalsIgnoreMetadata(crs, modelCrs)) { // we have to reproject the features
featureCollection = new ReprojectingFeatureCollection(featureCollection, crs, modelCrs);
}
Map<Class<?>, List<SimpleFeature>> featureListMap = new HashMap<>();
final FeatureIterator<SimpleFeature> featureIterator = featureCollection.features();
while (featureIterator.hasNext()) {
SimpleFeature feature = featureIterator.next();
Object defaultGeometry = feature.getDefaultGeometry();
Class<?> geometryType = defaultGeometry.getClass();
List<SimpleFeature> featureList = featureListMap.get(geometryType);
if (featureList == null) {
featureList = new ArrayList<>();
featureListMap.put(geometryType, featureList);
}
featureList.add(feature);
}
return featureListMap;
}
代码示例来源:origin: bcdev/beam
private SimpleFeatureType createFeatureType() throws IOException {
readHeader();
SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder();
//ftb.setName("org.esa.beam.TrackPoint");
ftb.setName("gov.nasa.gsfc.seabass.vectorData");
/*0*/
ftb.add("pixelPos", Point.class, geoCoding.getImageCRS());
/*1*/
ftb.add("geoPos", Point.class, DefaultGeographicCRS.WGS84);
for (ColumnInfo info : columnInfos) {
if (!info.getName().equals("lat") && !info.getName().equals("lon")) {
ftb.add(info.getName(), info.getDataClass());
}
}
ftb.setDefaultGeometry(geoCoding instanceof CrsGeoCoding ? "geoPos" : "pixelPos");
// GeoTools Bug: this doesn't work
// ftb.userData("trackPoints", "true");
final SimpleFeatureType ft = ftb.buildFeatureType();
ft.getUserData().put("trackPoints", "true");
return ft;
}
代码示例来源:origin: bcdev/beam
addRow("WKT of the image CRS", geoCoding.getImageCRS().toString());
addRow("WKT of the geographical CRS", geoCoding.getGeoCRS().toString());
内容来源于网络,如有侵权,请联系作者删除!