14 #ifndef _TRANSFORMATION_H_ 15 #define _TRANSFORMATION_H_ 19 #include "ogr_spatialref.h" 22 #include "NamespaceHeader.H" 30 virtual RealVect
transform(
const RealVect& x)
const=0;
70 Real m_e, m_a, m_k0, m_lon0;
75 (
const Real& a_e,
const Real& a_a,
const Real& a_k0,
const Real& a_lon0,
77 :m_e(a_e),m_a(a_a),m_k0(a_k0),m_lon0(a_lon0),m_fx(a_fx)
84 Real rho = std::sqrt( std::pow(x[0]-m_fx[0],2) + std::pow(x[1]-m_fx[1],2));
85 Real t = 0.5 * rho * std::sqrt ( std::pow(1.0+e,1.0+e) * std::pow(1.0-e,1.0-e)) /( 2.0 * m_a * m_k0);
86 Real chi = 0.5*pi - 2.0*std::atan(t);
88 + std::sin(2.0*chi) * (0.5 * std::pow(e,2) + 5.0*std::pow(e,4)/24.0 + std::pow(e,6)/12.0 + 13.0*std::pow(e,8)/360.0)
89 + std::sin(4.0*chi) * (7.0*std::pow(e,4)/48.0 + 29.0*std::pow(e,6)/240.0 + 811.0*std::pow(e,8)/11520.0)
90 + std::sin(6.0*chi) * (7.0*std::pow(e,6)/120.0 + 81.0*std::pow(e,8)/1120.0)
91 + std::sin(8.0*chi) * (4729.0*std::pow(e,8)/161280.0);
94 Real lon = m_lon0 + std::atan2 ( x[0]-m_fx[0] , m_fx[1]-x[1] );
116 OGRSpatialReference source, *poLatLon;
117 OGRCoordinateTransformation *mapping;
123 (
const int& a_epsg,
const Real& a_x0,
const Real& a_y0)
124 :m_epsg(a_epsg),m_x0(a_x0),m_y0(a_y0)
127 source.importFromEPSG( m_epsg );
128 poLatLon = source.CloneGeogCS();
129 mapping = OGRCreateCoordinateTransformation( &source, poLatLon );
131 CH_assert( mapping != NULL );
135 source.exportToWkt( &pszwkt );
136 pout() <<
" " << std::endl;
137 pout() << pszwkt << std::endl;
138 pout() <<
" " << std::endl;
140 if (pszwkt) {
delete pszwkt; pszwkt=NULL;}
143 istringstream ist(SRS_UA_DEGREE_CONV);
150 if (mapping) {
delete mapping; mapping=NULL;}
151 if (poLatLon) {
delete poLatLon; poLatLon=NULL;}
167 CH_assert( mapping->Transform(nPoints, &rwk[0], &rwk[1], &z) );
168 RealVect r ( D_DECL(rwk[1], rwk[0], z));
179 #include "NamespaceFooter.H" ~gdalxytolatlon()
Definition: Transformation.H:148
virtual RealVect transform(const RealVect &x) const
given x, compute x'
Definition: Transformation.H:154
Definition: Transformation.H:107