public class PixelGeoCoding extends AbstractGeoCoding implements BasicPixelGeoCoding
PixelGeoCoding
is an implementation of a GeoCoding
which uses
dedicated latitude and longitude bands in order to provide geographical positions
for each pixel. Unlike the TiePointGeoCoding
, which uses sub-sampled tie-point grids
,
the PixelGeoCoding
class uses bands
.
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,
the getPixelPos(GeoPos, PixelPos)
uses two different search algorithms in order to
find the corresponding geo-position for a given pixel:
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:
The advantage of this algorithm is that it obviously avoids problems related to the antimeridian and poles included in the source region.
Constructor and Description |
---|
PixelGeoCoding(Band latBand,
Band lonBand,
String validMask,
int searchRadius)
Constructs a new pixel-based geo-coding.
|
PixelGeoCoding(Band latBand,
Band lonBand,
String validMask,
int searchRadius,
ProgressMonitor pm)
Constructs a new pixel-based geo-coding.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canGetGeoPos()
Checks whether or not this geo-coding can determine the geodetic position from a pixel position.
|
boolean |
canGetPixelPos()
Checks whether or not this geo-coding can determine the pixel position from a geodetic position.
|
void |
dispose()
Releases all of the resources used by this object instance and all of its owned children.
|
boolean |
equals(Object o) |
protected void |
fillInvalidGaps(IndexValidator validator,
float[] latElems,
float[] lonElems,
ProgressMonitor pm)
Fills the gaps in the given latitude and longitude data buffers.
|
org.esa.snap.core.dataop.maptransf.Datum |
getDatum()
Gets the datum, the reference point or surface against which
GeoPos measurements are made. |
GeoPos |
getGeoPos(PixelPos pixelPos,
GeoPos geoPos)
Returns the latitude and longitude value for a given pixel co-ordinate.
|
Band |
getLatBand() |
Band |
getLonBand() |
PixelPos |
getPixelPos(GeoPos geoPos,
PixelPos pixelPos)
Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon.
|
GeoCoding |
getPixelPosEstimator()
Gets the underlying geo-coding used as pixel position estimator.
|
void |
getPixelPosUsingEstimator(GeoPos geoPos,
PixelPos pixelPos)
Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon.
|
void |
getPixelPosUsingQuadTreeSearch(GeoPos geoPos,
PixelPos pixelPos)
Returns the pixel co-ordinates as x/y for a given geographical position given as lat/lon.
|
static long |
getRequiredMemory(Product product,
boolean usesValidMask)
Computes an estimation of the memory required to create an instance of this class for the given product.
|
int |
getSearchRadius()
Gets the search radius used by this geo-coding.
|
String |
getValidMask() |
int |
hashCode() |
boolean |
isCrossingMeridianAt180()
Checks whether or not the longitudes of this geo-coding cross the +/- 180 degree meridian.
|
boolean |
transferGeoCoding(Scene srcScene,
Scene destScene,
ProductSubsetDef subsetDef)
|
createImageCRS, getGeoCRS, getImageCRS, getImageToMapTransform, getMapCRS, setGeoCRS, setImageCRS, setMapCRS
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getGeoCRS, getImageCRS, getImageToMapTransform, getMapCRS
public PixelGeoCoding(Band latBand, Band lonBand, String validMask, int searchRadius)
Use with care: In contrast to the other constructor this one loads the data not until first access to
getPixelPos(GeoPos, PixelPos)
or getGeoPos(PixelPos, GeoPos)
.
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 be null
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.public PixelGeoCoding(Band latBand, Band lonBand, String validMask, int searchRadius, ProgressMonitor pm) throws IOException
Use with care: This constructor fully loads the data given by the latitudes and longitudes bands and the valid mask (if any) into memory.
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 be null
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 progressIOException
- if an I/O error occurs while additional data is loaded from the source productprotected void fillInvalidGaps(IndexValidator validator, float[] latElems, float[] lonElems, ProgressMonitor pm)
Fills the gaps in the given latitude and longitude data buffers.
The method shall fill in reasonable a latitude and longitude value at all positions where
validator.validateIndex(pixelIndex)
returns false.
The default implementation uses the underlying estimator
(if any)
to find default values for the gaps.
validator
- the pixel validator, never nulllatElems
- the latitude data buffer in row-major orderlonElems
- the longitude data buffer in row-major orderpm
- a monitor to inform the user about progresspublic static long getRequiredMemory(Product product, boolean usesValidMask)
public Band getLatBand()
getLatBand
in interface BasicPixelGeoCoding
public Band getLonBand()
getLonBand
in interface BasicPixelGeoCoding
public String getValidMask()
getValidMask
in interface BasicPixelGeoCoding
public GeoCoding getPixelPosEstimator()
getPixelPosEstimator
in interface BasicPixelGeoCoding
public int getSearchRadius()
getSearchRadius
in interface BasicPixelGeoCoding
public boolean isCrossingMeridianAt180()
isCrossingMeridianAt180
in interface GeoCoding
true
, if sopublic boolean canGetPixelPos()
canGetPixelPos
in interface GeoCoding
true
, if sopublic boolean canGetGeoPos()
canGetGeoPos
in interface GeoCoding
true
, if sopublic PixelPos getPixelPos(GeoPos geoPos, PixelPos pixelPos)
getPixelPos
in interface GeoCoding
geoPos
- the geographical position as lat/lon.pixelPos
- an instance of Point
to be used as return value. If this parameter is
null
, the method creates a new instance which it then returns.public void getPixelPosUsingEstimator(GeoPos geoPos, PixelPos pixelPos)
geoPos
- the geographical position as lat/lon.pixelPos
- the return value.public void getPixelPosUsingQuadTreeSearch(GeoPos geoPos, PixelPos pixelPos)
geoPos
- the geographical position as lat/lon.pixelPos
- the return valuepublic GeoPos getGeoPos(PixelPos pixelPos, GeoPos geoPos)
public void dispose()
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.
public boolean transferGeoCoding(Scene srcScene, Scene destScene, ProductSubsetDef subsetDef)
transferGeoCoding
in class AbstractGeoCoding
srcScene
- the source scenedestScene
- the destination scenesubsetDef
- the definition of the subset, may be null
Copyright © 2014–2016 European Space Agency (ESA). All rights reserved.