private void addGeoCoding(Product product, LogVolDescriptor logVolDescriptor) { GeoCoding geoCoding = logVolDescriptor.getGeoCoding(); if (geoCoding != null) { product.setGeoCoding(geoCoding); } }
@Override protected Void doInBackground(ProgressMonitor pm) throws Exception { final GeoCoding pixelGeoCoding = GeoCodingFactory.createPixelGeoCoding(latBand, lonBand, validMask, searchRadius, pm); product.setGeoCoding(pixelGeoCoding); return null; }
/** * Adds the geocoding to the product */ private void addGeoCoding(Product prodRet) { prodRet.setGeoCoding(_file.getGeoCoding()); }
private static void removeGeoCodingAndTiePointGrids(Product product) { product.setGeoCoding(null); final TiePointGrid[] pointGrids = product.getTiePointGrids(); for (TiePointGrid pointGrid : pointGrids) { product.removeTiePointGrid(pointGrid); } }
private void removeGeoCodingAndTiePointGrids(Product product) { product.setGeoCoding(null); final TiePointGrid[] pointGrids = product.getTiePointGrids(); for (TiePointGrid pointGrid : pointGrids) { product.removeTiePointGrid(pointGrid); } }
/** * Installs an Envisat-specific tie-point geo-coding in the given product. */ public static void initTiePointGeoCoding(final Product product) { TiePointGrid latGrid = product.getTiePointGrid(EnvisatConstants.LAT_DS_NAME); TiePointGrid lonGrid = product.getTiePointGrid(EnvisatConstants.LON_DS_NAME); if (latGrid != null && lonGrid != null) { product.setGeoCoding(new TiePointGeoCoding(latGrid, lonGrid, Datum.WGS_84)); } }
private void detachGeoCoding(Product product) { if (product.getGeoCoding() instanceof GcpGeoCoding) { GeoCoding gc = ((GcpGeoCoding) product.getGeoCoding()).getOriginalGeoCoding(); product.setGeoCoding(gc); } updateUIState(); }
private static void setGeoCoding(Product product, String epsgCode) throws FactoryException, TransformException { final CoordinateReferenceSystem crs = CRS.decode(epsgCode, true); final Rectangle imageBounds = new Rectangle(product.getSceneRasterWidth(), product.getSceneRasterHeight()); final AffineTransform imageToMap = new AffineTransform(); imageToMap.translate(0.7, 0.8); imageToMap.scale(0.9, -0.8); imageToMap.translate(-0.5, -0.6); product.setGeoCoding(new CrsGeoCoding(crs, imageBounds, imageToMap)); }
private void setMapGeoCoding(Product product) { try { GeoCoding geoCoding = new CrsGeoCoding(DefaultGeographicCRS.WGS84, new Rectangle(0, 0, SIZE, SIZE), new AffineTransform(I2M)); product.setGeoCoding(geoCoding); } catch (FactoryException e) { fail(e.getMessage()); } catch (TransformException e) { fail(e.getMessage()); } }
private static Product createProduct(final String name, final int easting, final int northing, final float bandFillValue) throws FactoryException, TransformException { final Product product = new Product(name, "T", WIDTH, HEIGHT); product.addBand(createBand(bandFillValue)); final AffineTransform transform = new AffineTransform(); transform.translate(easting, northing); transform.scale(1, -1); transform.translate(-0.5, -0.5); product.setGeoCoding( new CrsGeoCoding(CRS.decode("EPSG:4326", true), new Rectangle(0, 0, WIDTH, HEIGHT), transform)); return product; }
private static Product createDummyProduct() { Product dummyProduct = new Product("blah", "blahType", 360, 180); dummyProduct.setGeoCoding(new VectorDataNodeReaderTest.DummyGeoCoding()); return dummyProduct; }
private static Product createDummyProduct() { Product dummyProduct = new Product("blah", "blahType", 360, 180); dummyProduct.setGeoCoding(new VectorDataNodeReaderTest.DummyGeoCoding()); return dummyProduct; }
private static Product createDummyProduct() { Product dummyProduct = new Product("blah", "blahType", 360, 180); dummyProduct.setGeoCoding(new DummyGeoCoding()); return dummyProduct; }
public void addGeocoding(final Product product) throws ProductIOException { final String longitude = "longitude"; final String latitude = "latitude"; Band latBand = product.getBand(latitude); Band lonBand = product.getBand(longitude); latBand.setNoDataValue(-999.); lonBand.setNoDataValue(-999.); latBand.setNoDataValueUsed(true); lonBand.setNoDataValueUsed(true); product.setGeoCoding(GeoCodingFactory.createPixelGeoCoding(latBand, lonBand, null, 5)); } }
private Product createSourceProduct() throws FactoryException, TransformException { Product sourceProduct = new Product("MERIS", "MARCO", 10, 10); sourceProduct.addBand("x", "5.1"); sourceProduct.setGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 10, 10, 0, 0, 1, 1)); return sourceProduct; }
@Before public void setup() throws TransformException, FactoryException { final AffineTransform i2m = new AffineTransform(); i2m.scale(2.0, 2.0); final GeoCoding geoCoding = new CrsGeoCoding(DefaultGeographicCRS.WGS84, new Rectangle(0, 0, 10, 10), i2m); final Product product = new Product("P", "T", 10, 10); product.setGeoCoding(geoCoding); placemark = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "P1", "L", "", new PixelPos(1.0f, 1.0f), null, product.getGeoCoding()); product.getPinGroup().add(placemark); }
public static void main(String[] args) throws TransformException, FactoryException { Product product1 = new Product("A", "B", 360, 180); product1.setGeoCoding(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.getGeoCoding()); product1.getPinGroup().add(pin1); showEditPlacemarkDialog(null, product1, pin1, descriptor); } }
private void doTestTransferGeoCoding() throws IOException { Product sourceProduct = createProduct(); GeoCoding newGeoCoding = new PixelGeoCoding(sourceProduct.getBand("latBand"), sourceProduct.getBand("lonBand"), null, 5, ProgressMonitor.NULL); sourceProduct.setGeoCoding(newGeoCoding); Product targetProduct = createProduct(); targetProduct.setGeoCoding(null); // remove geo-coding of target product sourceProduct.transferGeoCodingTo(targetProduct, null); PixelGeoCoding targetGC = (PixelGeoCoding) targetProduct.getGeoCoding(); assertNotNull(targetGC.getPixelPosEstimator()); }
@Before public void setUp() throws Exception { sourceP = new Product("test", "test", 6, 7); final Band latBand = sourceP.addBand(bandNameLat, ProductData.TYPE_FLOAT32); fillWithData(latBand, 0.03f, 30f); final Band lonBand = sourceP.addBand(bandNameLon, ProductData.TYPE_FLOAT32); fillWithData(lonBand, 0.047f, 50f); pixelGeoCoding = GeoCodingFactory.createPixelGeoCoding(latBand, lonBand, null, 5); sourceP.setGeoCoding(pixelGeoCoding); }
@Test public void testDecodeQualificationForTIFFWithGeoInformation() throws IOException { final Product product = new Product("p", "t", 20, 10); final Band band = product.addBand("band1", ProductData.TYPE_INT8); band.ensureRasterData(); final MapInfo mapInfo = new MapInfo(UTM.createProjection(26, true), 0, 0, 0, 0, 1, 1, Datum.WGS_84); mapInfo.setSceneWidth(product.getSceneRasterWidth()); mapInfo.setSceneHeight(product.getSceneRasterHeight()); product.setGeoCoding(new MapGeoCoding(mapInfo)); final ImageInputStream inputStream = writeToInputStream(product); final DecodeQualification decodeQualification = GeoTiffProductReaderPlugIn.getDecodeQualificationImpl(inputStream); assertEquals(DecodeQualification.SUITABLE, decodeQualification); }