private GeoPos getGeoPos(int x, int y) { final GeoPos geoPos = new GeoPos(); final GeoCoding geoCoding = sourceProduct.getSceneGeoCoding(); final PixelPos pixelPos = new PixelPos(x, y); geoCoding.getGeoPos(pixelPos, geoPos); return geoPos; }
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}; }
private void addFlagDescriptor(String name, int value, String description) { MetadataAttribute attribute = new MetadataAttribute(name, ProductData.TYPE_INT32); attribute.getData().setElemInt(value); attribute.setDescription(description); flagCoding.addAttribute(attribute); }
public static void main(String[] args) throws TransformException, FactoryException { Product product1 = new Product("A", "B", 360, 180); product1.setSceneGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 360, 180, -180.0, 90.0, 1.0, 1.0, 0.0, 0.0)); PinDescriptor descriptor = PinDescriptor.getInstance(); Placemark pin1 = Placemark.createPointPlacemark(descriptor, "pin_1", "Pin 1", "Schnatter!", new PixelPos(0, 0), new GeoPos(), product1.getSceneGeoCoding()); product1.getPinGroup().add(pin1); showEditPlacemarkDialog(null, product1, pin1, descriptor); } }
public static void createVirtualIntensityBand(final Product product, final Band band, final String countStr) { final String expression = band.getName() + " * " + band.getName(); final VirtualBand virtBand = new VirtualBand("Intensity" + countStr, ProductData.TYPE_FLOAT32, band.getRasterWidth(), band.getRasterHeight(), expression); virtBand.setUnit(Unit.INTENSITY); virtBand.setDescription("Intensity from complex data"); virtBand.setNoDataValueUsed(true); product.addBand(virtBand); }
private Band findReferenceBand(Product product, int width) { Band referenceBand = null; for (Band band : product.getBands()) { if (band.getRasterWidth() == width) { referenceBand = band; break; } } return referenceBand; }
private double getData(MetadataElement element) { if (element.getElement("Values") != null) { return element.getElement("Values").getAttribute("data").getData().getElemDouble(); } return 0; }
public String getMasksFolder() { String maskFolderName = null; MetadataAttribute currentElement; MetadataElement filesElement; if (((filesElement = rootElement.getElement(SpotConstants.SPOT4_TAKE5_TAG_FILES)) != null)) { if ((currentElement = filesElement.getAttribute(SpotConstants.SPOT4_TAKE5_TAG_MASK_N2)) != null) { ProductData data = currentElement.getData(); maskFolderName = data != null ? data.toString() : null; } } return maskFolderName; }
private static float[] getLatData(final Product product, final String latGridName) { final int size = product.getSceneRasterHeight(); final TiePointGrid latGrid = product.getTiePointGrid(latGridName); if (latGrid != null) return latGrid.getPixels(0, 0, 1, size, (float[]) null); return null; }
protected FlagCoding createFlagCoding(Product product) { FlagCoding flagCoding = new FlagCoding("unusable_data"); flagCoding.addFlag(RapidEyeConstants.FLAG_BLACK_FILL, 1, "area was not imaged by spacecraft"); flagCoding.addFlag(RapidEyeConstants.FLAG_CLOUDS, 2, "cloud covered"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_BLUE_DATA, 4, "missing/suspect data in blue band"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_GREEN_DATA, 8, "missing/suspect data in green band"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_RED_DATA, 16, "missing/suspect data in red band"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_RED_EDGE_DATA, 32, "missing/suspect data in red edge band"); flagCoding.addFlag(RapidEyeConstants.FLAG_MISSING_NIR_DATA, 64, "missing/suspect data in nir band"); product.getFlagCodingGroup().add(flagCoding); return flagCoding; }
@Override protected void registerRGBProfile() { RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("RapidEye L1", new String[] { "red", "green", "blue" })); } }
private static void addAttrib(final MetadataElement elem, final String tag, final double value) { final MetadataAttribute attrib = new MetadataAttribute(tag, ProductData.TYPE_FLOAT64); attrib.getData().setElemDouble(value); elem.addAttribute(attrib); }
@Override protected boolean isValidMaskPixel(int x, int y) { boolean isValidMaskPixel = false; for (int k=0; k<this.maskNamesToCombine.length && !isValidMaskPixel; k++) { Mask sourceMask = this.product.getMaskGroup().get(this.maskNamesToCombine[k]); if (sourceMask.getSampleInt(x, y) != ForestCoverChangeConstants.NO_DATA_VALUE) { isValidMaskPixel = true; } } return isValidMaskPixel; } }
private void addAttributes(MetadataElement element) { element.addAttribute(new MetadataAttribute("string", ProductData.createInstance("O815"), true)); element.addAttribute(new MetadataAttribute("singleValue", ProductData.createInstance(new byte[]{108}), true)); element.addAttribute(new MetadataAttribute("array", ProductData.createInstance(new byte[]{4, 8, 15, 16, 23, 42}), true)); element.addAttribute(new MetadataAttribute("splittedArray.1", ProductData.createInstance(new byte[]{4}), true)); element.addAttribute(new MetadataAttribute("splittedArray.2", ProductData.createInstance(new byte[]{8}), true)); element.addAttribute(new MetadataAttribute("splittedArray.3", ProductData.createInstance(new byte[]{15}), true)); element.addAttribute(new MetadataAttribute("splittedArray.4", ProductData.createInstance(new byte[]{16}), true)); element.addAttribute(new MetadataAttribute("splittedArray.5", ProductData.createInstance(new byte[]{23}), true)); element.addAttribute(new MetadataAttribute("splittedArray.6", ProductData.createInstance(new byte[]{42}), true)); } }
/** * Get first line time from the abstracted metadata (in days). */ private void getFirstLineTime() { firstLineUTC = absRoot.getAttributeUTC(AbstractMetadata.first_line_time).getMJD(); // in days }
private static boolean isValid(Placemark p) { final PixelPos pixelPos = p.getPixelPos(); final GeoPos geoPos = p.getGeoPos(); return pixelPos != null && pixelPos.isValid() && geoPos != null && geoPos.isValid(); }
@Override public void undo() { final PlacemarkGroup placemarkGroup = placemarkDescriptor.getPlacemarkGroup(product); for (Placemark placemark : placemarks) { placemarkGroup.add(placemark); } }
private Band findReferenceBand(Product product, int width) { Band referenceBand = null; for (Band band : product.getBands()) { if (band.getRasterWidth() == width) { referenceBand = band; break; } } return referenceBand; }
@Override protected void registerRGBProfile() { RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("SPOT", new String[] { "XS1", "XS2", "XS3" })); } }
@Override protected void registerRGBProfile() { RGBImageProfileManager.getInstance().addProfile(new RGBImageProfile("DEIMOS-1", new String[] { "Red", "Green", "NIR" })); } }