Loading...
Searching...
No Matches
Reprojection.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/raster/Reprojection.h
22
23 \brief It contains the algorithm to reproject raster data.
24*/
25
26#ifndef __TERRALIB_RASTER_INTERNAL_REPROJECTION_H
27#define __TERRALIB_RASTER_INTERNAL_REPROJECTION_H
28
29// TerraLib
30#include "Config.h"
31#include "Interpolator.h"
32
33// STL
34#include <map>
35#include <string>
36
37namespace te
38{
39// Forward declarations
40 namespace gm { class Envelope; }
41 namespace srs { class Converter; }
42
43 namespace rst
44 {
45 class Raster;
46
47 /*!
48 \brief Reprojects a raster to another SRS.
49
50 \param rin The input raster file. Do not pass a null pointer.
51 \param srid The target SRID for the reprojection.
52 \param routinfo The basic parameters necessary to create the reprojected raster.
53 \param m The method of interpolation to apply. \sa te::rst::Interpolator
54
55 \return A pointer to the raster reprojected if success or a null pointer otherwise.
56
57 \exception Exception This function might through an exception if the coordinate conversion fails.
58
59 \note The caller will take the ownership of the returned pointer.
60 */
61 TERASTEREXPORT te::rst::Raster* Reproject(te::rst::Raster const * const rin, int srid, const std::map<std::string, std::string>& routinfo, int m = te::rst::NearestNeighbor);
62
63 /*!
64 \brief Reprojects a portion of a raster to another SRS.
65
66 \param rin The input raster file. Do not pass a null pointer.
67 \param srid The target SRID for the reprojection.
68 \param llx Lower-left X-coordinate of the portion to be reprojected (in the original SRS).
69 \param lly Lower-left Y-coordinate of the portion to be reprojected (in the original SRS).
70 \param urx Upper-Right X-coordinate of the portion to be reprojected (in the original SRS).
71 \param ury Upper-Right Y-coordinate of the portion to be reprojected (in the original SRS).
72 \param routinfo The basic parameters necessary to create the reprojected raster.
73 \param m The method of interpolation to apply. \sa te::rst::Interpolator
74
75 \return A pointer to the raster reprojected if success or a null pointer otherwise.
76
77 \exception Exception This function might through an exception if the coordinate conversion fails.
78
79 \note The caller will take the ownership of the returned pointer.
80 */
81 TERASTEREXPORT te::rst::Raster* Reproject(te::rst::Raster const * const rin, int srid, double llx, double lly, double urx, double ury, const std::map<std::string, std::string>& routinfo, int m = te::rst::NearestNeighbor);
82
83 /*!
84 \brief Reprojects a portion of a raster to another SRS and maintaining a given resolution.
85
86 \param rin The input raster file. Do not pass a null pointer.
87 \param srid The target SRID for the reprojection.
88 \param llx Lower-left X-coordinate of the portion to be reprojected (in the original SRS).
89 \param lly Lower-left Y-coordinate of the portion to be reprojected (in the original SRS).
90 \param urx Upper-Right X-coordinate of the portion to be reprojected (in the original SRS).
91 \param ury Upper-Right Y-coordinate of the portion to be reprojected (in the original SRS).
92 \param resx The output x resolution (in units of the target SRS - if resx=0 the number of columns will be kept the same).
93 \param resy The output y resolution (in units of the target SRS - if resy=0 the number of rows will be kept the same).
94 \param routinfo The basic parameters necessary to create the reprojected raster.
95 \param m The method of interpolation to apply. \sa te::rst::Interpolator
96
97 \return A pointer to the raster reprojected if success or a null pointer otherwise.
98
99 \exception Exception This function might through an exception if the coordinate conversion fails.
100
101 \note The caller will take the ownership of the returned pointer.
102 */
103 TERASTEREXPORT te::rst::Raster* Reproject(te::rst::Raster const * const rin, int srid, double llx, double lly, double urx, double ury, double resx, double resy, const std::map<std::string, std::string>& routinfo, int m = te::rst::NearestNeighbor);
104
105 /*!
106 \brief Reprojects, clip and resample a subset of the raster.
107 \param newSRID The new output SRID
108 \param inputRaster Input raster.
109 \param inputRasterBands Input raster bands to process.
110 \param interpMethod The method of interpolation. \sa te::rst::Interpolator
111 \param interpWindowRadius Interpolator windows radius around the target pixel (when applicable).
112 \param firstRow The starting row to make a subset of the image.
113 \param firstColumn The starting column to make a subset of the image.
114 \param height The height of the subset.
115 \param width The width of the subset.
116 \param newheight The resampled height of the new raster.
117 \param newwidth The resampled width of the new raster.
118 \param maxThreads Maximum number of used threads to use (0-Automatic, 1-No threads used).
119 \param rinfo The parameters needed to build the output raster (see RasterFactory documentation).
120 \param dataSourceType Data source type (raster type. I.E. GDAL) or an empty string for de default driver.
121 \param outputRasterPtr The output raster pointer.
122 \return true if ok, false on errors.
123 */
125 int newSRID,
126 const te::rst::Raster& inputRaster,
127 const std::vector< unsigned int >& inputRasterBands,
128 const te::rst::Interpolator::Method interpMethod,
129 const unsigned int interpWindowRadius,
130 const unsigned int firstRow,
131 const unsigned int firstColumn,
132 const unsigned int height,
133 const unsigned int width,
134 const unsigned int newheight,
135 const unsigned int newwidth,
136 const unsigned int maxThreads,
137 const std::map<std::string, std::string>& rinfo,
138 const std::string& dataSourceType,
139 std::unique_ptr< te::rst::Raster >& outputRasterPtr );
140 }
141}
142
143#endif // __TERRALIB_RASTER_INTERNAL_REPROJECTION_H
It interpolates one pixel based on a selected algorithm.
An abstract class for raster data strucutures.
Definition Raster.h:72
InterpolationMethod
Allowed interpolation methods.
Definition Enums.h:93
@ NearestNeighbor
Near neighborhood interpolation method.
Definition Enums.h:95
TERASTEREXPORT te::rst::Raster * Reproject(te::rst::Raster const *const rin, int srid, const std::map< std::string, std::string > &routinfo, int m=te::rst::NearestNeighbor)
Reprojects a raster to another SRS.
TerraLib.
#define TERASTEREXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:63
Proxy configuration file for TerraView (see terraview_config.h).