Class PixelGeoCoding
- java.lang.Object
-
- org.esa.snap.core.datamodel.AbstractGeoCoding
-
- org.esa.snap.core.datamodel.PixelGeoCoding
-
- All Implemented Interfaces:
BasicPixelGeoCoding
,GeoCoding
@Deprecated public class PixelGeoCoding extends AbstractGeoCoding implements BasicPixelGeoCoding
Deprecated.since SNAP 8, useComponentGeoCoding
insteadDEPRECATED!The
PixelGeoCoding
is an implementation of aGeoCoding
which uses dedicated latitude and longitude bands in order to provide geographical positions for each pixel. Unlike theTiePointGeoCoding
, which uses sub-sampledtie-point grids
, thePixelGeoCoding
class usesbands
.This class is especially useful for high accuracy geo-coding, e.g. if geographical positions are computed for each pixel by an upstream orthorectification.
While the implementation of the
getGeoPos(PixelPos, GeoPos)
is straight forward, thegetPixelPos(GeoPos, PixelPos)
uses two different search algorithms in order to find the corresponding geo-position for a given pixel:- Search an N x N window around an estimated pixel position using the geo-coding of the source product (if any) or
- perform a quad-tree search if the source product has no geo-coding.
Use instances of this class with care: The constructor fully loads the data given by the latitudes and longitudes bands and the valid mask (if any) into memory.
Note (rq-20110526): A better implementation of the find pixel method could be something like:
- Create a coverage of the source region by means of largely overlapping image tiles (e.g. tile size of 100 pixels squared with an overlap of 25 pixels)
- For each tile create a rational function model of the (lon, lat) to (x, y) transformation, rotating to the (lon, lat) of the tile center
- Refine the accuracy of the selected rational function model until the accuracy goal (i.e. a certain RMSE) is reached
- Find all tiles {T1, T2, ...} that may include the (x, y) pixel coordinate of interest
- Select the tile T in {T1, T2, ...} where the the (x, y) result is nearest to (0, 0)
- Use the three closest pixels to compute the final (x, y)
- Keep all rational function approximations in a map and reuse them for subsequent calls.
The advantage of this algorithm is that it obviously avoids problems related to the antimeridian and poles included in the source region.
-
-
Constructor Summary
Constructors Constructor Description PixelGeoCoding(Band latBand, Band lonBand, String validMask, int searchRadius)
Deprecated.Constructs a new pixel-based geo-coding.PixelGeoCoding(Band latBand, Band lonBand, String validMask, int searchRadius, ProgressMonitor pm)
Deprecated.Constructs a new pixel-based geo-coding.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canGetGeoPos()
Deprecated.Checks whether or not this geo-coding can determine the geodetic position from a pixel position.boolean
canGetPixelPos()
Deprecated.Checks whether or not this geo-coding can determine the pixel position from a geodetic position.void
dispose()
Deprecated.Releases all of the resources used by this object instance and all of its owned children.boolean
equals(Object o)
Deprecated.Datum
getDatum()
Deprecated.Gets the datum, the reference point or surface against whichGeoPos
measurements are made.GeoPos
getGeoPos(PixelPos pixelPos, GeoPos geoPos)
Deprecated.Returns the latitude and longitude value for a given pixel co-ordinate.Band
getLatBand()
Deprecated.Band
getLonBand()
Deprecated.PixelPos
getPixelPos(GeoPos geoPos, PixelPos pixelPos)
Deprecated.Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon.GeoCoding
getPixelPosEstimator()
Deprecated.Gets the underlying geo-coding used as pixel position estimator.void
getPixelPosUsingEstimator(GeoPos geoPos, PixelPos pixelPos)
Deprecated.Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon.void
getPixelPosUsingQuadTreeSearch(GeoPos geoPos, PixelPos pixelPos)
Deprecated.Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon.static long
getRequiredMemory(Product product, boolean usesValidMask)
Deprecated.Computes an estimation of the memory required to create an instance of this class for the given product.int
getSearchRadius()
Deprecated.Gets the search radius used by this geo-coding.String
getValidMask()
Deprecated.int
hashCode()
Deprecated.boolean
isCrossingMeridianAt180()
Deprecated.Checks whether or not the longitudes of this geo-coding cross the +/- 180 degree meridian.boolean
transferGeoCoding(Scene srcScene, Scene destScene, ProductSubsetDef subsetDef)
Deprecated.-
Methods inherited from class org.esa.snap.core.datamodel.AbstractGeoCoding
canClone, clone, createImageCRS, getGeoCRS, getImageCRS, getImageToMapTransform, getMapCRS, setGeoCRS, setImageCRS, setMapCRS
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.esa.snap.core.datamodel.GeoCoding
canClone, clone, getGeoCRS, getImageCRS, getImageToMapTransform, getMapCRS
-
-
-
-
Constructor Detail
-
PixelGeoCoding
public PixelGeoCoding(Band latBand, Band lonBand, String validMask, int searchRadius)
Deprecated.Constructs a new pixel-based geo-coding.Use with care: In contrast to the other constructor this one loads the data not until first access to
getPixelPos(GeoPos, PixelPos)
orgetGeoPos(PixelPos, GeoPos)
.- Parameters:
latBand
- the band providing the latitudeslonBand
- the band providing the longitudesvalidMask
- the valid mask expression used to identify valid lat/lon pairs, e.g. "NOT l1_flags.DUPLICATED". Can benull
if a valid mask is not used.searchRadius
- the search radius in pixels, shall depend on the actual spatial scene resolution, e.g. for 300 meter pixels a search radius of 5 is a good choice. This parameter is ignored if the source product is not geo-coded.
-
PixelGeoCoding
public PixelGeoCoding(Band latBand, Band lonBand, String validMask, int searchRadius, ProgressMonitor pm) throws IOException
Deprecated.Constructs a new pixel-based geo-coding.Use with care: This constructor fully loads the data given by the latitudes and longitudes bands and the valid mask (if any) into memory.
- Parameters:
latBand
- the band providing the latitudeslonBand
- the band providing the longitudesvalidMask
- the valid mask expression used to identify valid lat/lon pairs, e.g. "NOT l1_flags.DUPLICATED". Can benull
if a valid mask is not used.searchRadius
- the search radius in pixels, shall depend on the actual spatial scene resolution, e.g. for 300 meter pixels a search radius of 5 is a good choice. This parameter is ignored if the source product is not geo-coded.pm
- a monitor to inform the user about progress- Throws:
IOException
- if an I/O error occurs while additional data is loaded from the source product
-
-
Method Detail
-
getRequiredMemory
public static long getRequiredMemory(Product product, boolean usesValidMask)
Deprecated.Computes an estimation of the memory required to create an instance of this class for the given product. The estimation is returned in bytes.- Returns:
- an estimation of the required memory in bytes
-
getLatBand
public Band getLatBand()
Deprecated.- Specified by:
getLatBand
in interfaceBasicPixelGeoCoding
-
getLonBand
public Band getLonBand()
Deprecated.- Specified by:
getLonBand
in interfaceBasicPixelGeoCoding
-
getValidMask
public String getValidMask()
Deprecated.- Specified by:
getValidMask
in interfaceBasicPixelGeoCoding
-
getPixelPosEstimator
public GeoCoding getPixelPosEstimator()
Deprecated.Gets the underlying geo-coding used as pixel position estimator.- Specified by:
getPixelPosEstimator
in interfaceBasicPixelGeoCoding
- Returns:
- the underlying delegate geo-coding, can be null
-
getSearchRadius
public int getSearchRadius()
Deprecated.Gets the search radius used by this geo-coding.- Specified by:
getSearchRadius
in interfaceBasicPixelGeoCoding
- Returns:
- the search radius in pixels
-
isCrossingMeridianAt180
public boolean isCrossingMeridianAt180()
Deprecated.Checks whether or not the longitudes of this geo-coding cross the +/- 180 degree meridian.- Specified by:
isCrossingMeridianAt180
in interfaceGeoCoding
- Returns:
true
, if so
-
canGetPixelPos
public boolean canGetPixelPos()
Deprecated.Checks whether or not this geo-coding can determine the pixel position from a geodetic position.- Specified by:
canGetPixelPos
in interfaceGeoCoding
- Returns:
true
, if so
-
canGetGeoPos
public boolean canGetGeoPos()
Deprecated.Checks whether or not this geo-coding can determine the geodetic position from a pixel position.- Specified by:
canGetGeoPos
in interfaceGeoCoding
- Returns:
true
, if so
-
getPixelPos
public PixelPos getPixelPos(GeoPos geoPos, PixelPos pixelPos)
Deprecated.Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon.- Specified by:
getPixelPos
in interfaceGeoCoding
- Parameters:
geoPos
- the geographical position as lat/lon.pixelPos
- an instance ofPoint
to be used as return value. If this parameter isnull
, the method creates a new instance which it then returns.- Returns:
- the pixel co-ordinates as x/y
-
getPixelPosUsingEstimator
public void getPixelPosUsingEstimator(GeoPos geoPos, PixelPos pixelPos)
Deprecated.Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon.- Parameters:
geoPos
- the geographical position as lat/lon.pixelPos
- the return value.
-
getPixelPosUsingQuadTreeSearch
public void getPixelPosUsingQuadTreeSearch(GeoPos geoPos, PixelPos pixelPos)
Deprecated.Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon. This algorithm- Parameters:
geoPos
- the geographical position as lat/lon.pixelPos
- the return value
-
getGeoPos
public GeoPos getGeoPos(PixelPos pixelPos, GeoPos geoPos)
Deprecated.Returns the latitude and longitude value for a given pixel co-ordinate.
-
dispose
public void dispose()
Deprecated.Releases all of the resources used by this object instance and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to
dispose()
are undefined.
-
transferGeoCoding
public boolean transferGeoCoding(Scene srcScene, Scene destScene, ProductSubsetDef subsetDef)
Deprecated.- Specified by:
transferGeoCoding
in classAbstractGeoCoding
- Parameters:
srcScene
- the source scenedestScene
- the destination scenesubsetDef
- the definition of the subset, may benull
- Returns:
- true, if the geo-coding could be transferred.
-
-