|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectschmitzm.geotools.grid.GridUtil
public class GridUtil
Diese Klasse stellt statische Funktionen fuer die Arbeit mit Rasterdaten zur Verfuegung.
Field Summary | |
---|---|
static Color[] |
DEFAULT_COLORS
11 Default colors used by #createDiscreteStyle(GridCoverage2D, double, Color...) if
no colors are given. |
static String |
DEFAULT_RASTER_STYLE_NAME
The default name for style created by createDefaultStyle(); |
static String |
DEFAULT_RASTER_STYLE_TITLE
|
static GridCoverageFactory |
GRID_FAC
|
static String |
UNNAMED_RASTER_STYLE_NAME
|
static String |
UNTITLED_RASTER_STYLE_TITLE
|
Constructor Summary | |
---|---|
GridUtil()
|
Method Summary | |
---|---|
static double |
convertRasterToReal(int cell,
int rasterMin,
double realMin,
double cellSize)
Converts a raster cell index to "real" world coordinates. |
static int |
convertRealToRaster(double coord,
double realMin,
double realLength,
int rasterMin,
int rasterLength)
Converts a real world coordinate to the row/column number of a raster. |
static int[] |
convertRealToRaster(Envelope2D env,
RenderedImage image,
double[] geoCoord)
Converts a geo reference to raster coordinates. |
static int[] |
convertRealToRaster(Envelope2D env,
RenderedImage image,
double geoX,
double geoY)
Converts a geo reference to raster coordinates. |
static int[] |
convertRealToRaster(GridCoverage2D gc,
double[] geoCoord)
Converts a geo reference to raster coordinates. |
static int[] |
convertRealToRaster(GridCoverage2D gc,
double geoX,
double geoY)
Converts a geo reference to raster coordinates. |
static GridCoverage2D |
convertToGridCoverage2D(Object obj)
Konvertiert ein Raster-Objekt in eine GridCoverage2D . |
static GridCoverage2D |
copyGridCoverage(GridCoverage2D source)
Kopiert ein GridCoverage2D komplett. |
static GridCoverage2D |
copyGridCoverage(GridCoverage2D source,
int minX,
int minY)
Kopiert ein GridCoverage2D komplett, dessen Raster-Koordinaten
(obere-linke Ecke) transformiert wird. |
static Style |
createDefaultStyle()
Erzeugt einen Standard-Style fuer ein GridCoverage2D
und setzt den default-Namen: GridUtil.DEFAULT_RASTER_STYLE_NAME
Und eine title : GridUtil.DEFAULT_RASTER_STYLE_TITLE |
static Style |
createDiscreteStyle(GridCoverage2D grid,
double opacity,
Integer digits,
Color... colorPalette)
Creates a discrete style for a GridCoverage2D . |
static GridCoverage2D |
createGridCoverage(GridCoverage2D source,
Envelope bboxEnv)
Erzeugt ein GridCoverage2D aus einem anderen. |
static Style |
createInterpolativeStyle(GridCoverage2D grid,
double opacity,
Color... colors)
Creates an interpolative style for a GridCoverage2D . |
static Style |
createStyle(ColorMap colorMap,
double opacity)
Erzeugt einen Standard-Style fuer ein GridCoverage2D |
static WritableRaster |
createWritableRaster(Raster r)
Erzeugt ein WritableRaster aus einem Raster . |
static WritableRaster |
createWritableRaster(Raster r,
int minX,
int minY)
Erzeugt ein WritableRaster aus einem Raster . |
static GridStatistic |
determineStatistic(GridCoverage2D gc,
int band)
Liefert statistische Daten ueber ein Grid, ohne ein Histogram zu berechnen. |
static GridStatistic |
determineStatistic(GridCoverage2D gc,
int band,
int histogramSteps)
Liefert statistische Daten ueber ein Grid und erstellt ein Histogramm. |
static GridStatistic |
determineStatistic(GridCoverage2D gc,
int band,
int histogramSteps,
Integer histogrammDigits)
Liefert statistische Daten ueber ein Grid und erstellt ein Histogramm |
static GridZoneStatistic<Float> |
determineZoneStatistic(GridCoverage2D valueGC,
GridCoverage2D zoneGC)
Liefert statistische Daten ueber ein Grid, das in Zonen unterteilt ist. |
static GridZoneStatistic<Float> |
determineZoneStatistic(GridCoverage2D valueGC,
int valueBand,
GridCoverage2D zoneGC,
int zoneBand)
Liefert statistische Daten ueber ein Grid, das in Zonen unterteilt ist. |
static GridCoverage2D |
getOverlappingCells(GridCoverage2D gc,
Geometry g,
Number markValue)
Marks all raster cells, which are intersected by a Geometry . |
static WritableRaster |
getOverlappingCells(GridCoverage2D gc,
Geometry g,
Number markValue,
WritableRaster result)
Marks all raster cells, which are intersected by a Geometry . |
static Set<Point> |
getOverlappingCells(GridCoverage2D gc,
LineString ls,
Set<Point> result)
Determines the raster cells, which are intersected by a LineString . |
static GridCoverage2D |
resampleGridCoverage(GridCoverage2D gc,
GridSampleDimension sampleDim)
Erzeugt ein neues GridCoverage2D mit neuer SampleDimension . |
static GridCoverage2D |
resampleGridCoverage(GridCoverage2D gc,
GridSampleDimension[] sampleDim)
Erzeugt ein neues GridCoverage2D mit neuer SampleDimension . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final GridCoverageFactory GRID_FAC
public static final String DEFAULT_RASTER_STYLE_NAME
public static final String DEFAULT_RASTER_STYLE_TITLE
public static final String UNNAMED_RASTER_STYLE_NAME
public static final String UNTITLED_RASTER_STYLE_TITLE
public static final Color[] DEFAULT_COLORS
#createDiscreteStyle(GridCoverage2D, double, Color...)
if
no colors are given.
Constructor Detail |
---|
public GridUtil()
Method Detail |
---|
public static GridStatistic determineStatistic(GridCoverage2D gc, int band, int histogramSteps, Integer histogrammDigits)
gc
- ein Rasterband
- zu untersuchendes BandhistogramSteps
- Schritte des Histogramms, -1 wenn alle Ausprägungen, 0 für ohne HistogrammhistogrammDigits
- Anzahl an Nachkommastellen auf die die Histogramm-Klassen gerundet werden
(negative Werte = Vorkommastellen; null = kein Runden). Nur relevant, wenn
hishistogramSteps
= -1public static GridStatistic determineStatistic(GridCoverage2D gc, int band, int histogramSteps)
gc
- ein Rasterband
- zu untersuchendes BandhistogramSteps
- Schritte des Histogramms, -1 wenn alle Ausprägungen, 0 für ohne Histogrammpublic static GridStatistic determineStatistic(GridCoverage2D gc, int band)
gc
- ein Rasterband
- zu untersuchendes Bandpublic static GridZoneStatistic<Float> determineZoneStatistic(GridCoverage2D valueGC, GridCoverage2D zoneGC)
Float
-Wert identifiziert, damit
auch NoData-Werte in einem Raster einer Zone (naemlich der
Zone Float.NaN
) zugewiesen werden koennen.
valueGC
- Raster ueber das die Statistik erzeugt wirdzoneGC
- Raster, das die Zonen bestimmtpublic static GridZoneStatistic<Float> determineZoneStatistic(GridCoverage2D valueGC, int valueBand, GridCoverage2D zoneGC, int zoneBand)
Float
-Wert identifiziert, damit
auch NoData-Werte in einem Raster einer Zone (naemlich der
Zone Float.NaN
) zugewiesen werden koennen.
valueGC
- Raster ueber das die Statistik erzeugt wirdvalueBand
- Band ueber das die Statistik erzeugt wirdzoneGC
- Raster, das die Zonen bestimmtzoneBand
- Band, das die Zonen bestimmtpublic static Style createDefaultStyle()
GridCoverage2D
und setzt den default-Namen: GridUtil.DEFAULT_RASTER_STYLE_NAME
Und eine title : GridUtil.DEFAULT_RASTER_STYLE_TITLE
public static Style createStyle(ColorMap colorMap, double opacity)
GridCoverage2D
colorMap
- Farb-Paletteopacity
- Transparenz (1.0 = vollfarbig)
StyleBuilder.createRasterSymbolizer()
) falls
keine ColorMap angegeben wirdpublic static Style createInterpolativeStyle(GridCoverage2D grid, double opacity, Color... colors)
GridCoverage2D
. The given colors
are interpolated from the minimum to the maximum raster value.
grid
- the rasteropacity
- opacity for the stylecolors
- colors to interpolate with (at least 2)public static Style createDiscreteStyle(GridCoverage2D grid, double opacity, Integer digits, Color... colorPalette)
GridCoverage2D
. For every value
in the raster another color is choosen. If the raster contains more values
than colors are given, all surplus values are mapped to the "last" color.
grid
- the rasteropacity
- opacity for the styledigits
- number of digits the grid value classes (and legend) are
rounded to (null means no round; >= 0 means digits after comma;
< 0 means digits before comma)colorPalette
- colors for the values (the smallest value is mapped to index 0, the second
smallest to index 1, ...); if no colors are specified DEFAULT_COLORS
are usedpublic static GridCoverage2D copyGridCoverage(GridCoverage2D source)
GridCoverage2D
komplett.
source
- Quell-Rasterpublic static GridCoverage2D copyGridCoverage(GridCoverage2D source, int minX, int minY)
GridCoverage2D
komplett, dessen Raster-Koordinaten
(obere-linke Ecke) transformiert wird.
source
- Quell-RasterminX
- neue Raster-Koordinate fuer die obere linke EckeminY
- neue Raster-Koordinate fuer die obere linke Eckepublic static GridCoverage2D resampleGridCoverage(GridCoverage2D gc, GridSampleDimension sampleDim)
GridCoverage2D
mit neuer SampleDimension
.
gc
- Raster (mit nur einem Band)sampleDim
- neue SampleDimension
GridCoverage2D
-Instanzpublic static GridCoverage2D resampleGridCoverage(GridCoverage2D gc, GridSampleDimension[] sampleDim)
GridCoverage2D
mit neuer SampleDimension
.
gc
- RastersampleDim
- neue SampleDimension
GridCoverage2D
-Instanzpublic static GridCoverage2D createGridCoverage(GridCoverage2D source, Envelope bboxEnv)
GridCoverage2D
aus einem anderen. Das neue Raster
hat maximal die Ausmasse des Quell-Rasters.
source
- Quell-RasterbboxEnv
- Bounding-Box (beschreibt die den Ausschnitt des Quell-Rasters aus dem
das neue Raster erzeugt wird)
null
falls sich das Quell-Raster und die Bounding-Box nicht
ueberschneiden.public static WritableRaster createWritableRaster(Raster r, int minX, int minY)
WritableRaster
aus einem Raster
.
r
- RasterminX
- Start-Index in X-RichtungminY
- Start-Index in Y-Richtungpublic static WritableRaster createWritableRaster(Raster r)
WritableRaster
aus einem Raster
.
r
- Rasterpublic static GridCoverage2D convertToGridCoverage2D(Object obj)
GridCoverage2D
.
Es werden folgende Objekt-Typen unterstuetzt:
GridCoverage2D
WritableRaster
und WritableGrid
WritableGridArray
obj
- Object
IllegalArgumentException
- falls das Objekt nicht konvertiert werden kannpublic static int convertRealToRaster(double coord, double realMin, double realLength, int rasterMin, int rasterLength)
coord
- geographic reference (world coordinate), which is convertedrealMin
- minimal world coordinate of the rasterrealLength
- length of the raster in "world coordinates"rasterMin
- index of the first raster cell (normally 0)rasterLength
- size of the raster (in cells)
UnsupportedOperationException
- falls als rasterLength
0
uebergeben wirdpublic static double convertRasterToReal(int cell, int rasterMin, double realMin, double cellSize)
cell
- raster index, which is convertedrasterMin
- minimal index of the rasterrealMin
- minimal world coordinate of the rastercellSize
- size of one cell in "world coordinates"public static int[] convertRealToRaster(GridCoverage2D gc, double geoX, double geoY)
gc
- source rastergeoX
- Longitude to be convertedgeoY
- Latitude to be converted
public static int[] convertRealToRaster(Envelope2D env, RenderedImage image, double geoX, double geoY)
env
- geo reference of the rasterimage
- image of the rastergeoX
- Longitude to be convertedgeoY
- Latitude to be converted
public static int[] convertRealToRaster(GridCoverage2D gc, double[] geoCoord)
gc
- source rastergeoCoord
- geo reference (Longitude,Latitude) to be converted
public static int[] convertRealToRaster(Envelope2D env, RenderedImage image, double[] geoCoord)
env
- geo reference of the rasterimage
- image of the rastergeoCoord
- geo reference (Longitude,Latitude) to be converted
public static Set<Point> getOverlappingCells(GridCoverage2D gc, LineString ls, Set<Point> result)
LineString
.
gc
- the rasterls
- LineString
to checkresult
- Set the intersected cells are inserted in (can be null
)
public static WritableRaster getOverlappingCells(GridCoverage2D gc, Geometry g, Number markValue, WritableRaster result)
Geometry
.
gc
- the rasterg
- Geometry, which is checked for intersectionmarkValue
- value the intersected cells are marked withresult
- Raster, the intersected cells are marked in (can be null
)public static GridCoverage2D getOverlappingCells(GridCoverage2D gc, Geometry g, Number markValue)
Geometry
.
gc
- the rasterg
- Geometry, checked for intersectionmarkValue
- value the intersected cells are marked with
GridCoverage2D
!!
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |