Ticket #2134: gdal-1.6.0-eqc-glabsgm.patch

File gdal-1.6.0-eqc-glabsgm.patch, 15.1 kB (added by dgrichard, 4 months ago)

Generalized eqc and glabsgm patch

  • gdal-trunk/ogr/ogrspatialreference.cpp

    old new  
    31723172} 
    31733173 
    31743174/************************************************************************/ 
    3175 /*                         SetEquidistantCylindricalSphere()            */ 
     3175/*                         SetEquirectangular()                         */ 
    31763176/************************************************************************/ 
    31773177 
    3178 OGRErr OGRSpatialReference::SetEquidistantCylindricalSphere
     3178OGRErr OGRSpatialReference::SetEquirectangular
    31793179                                   double dfCenterLat, double dfCenterLong, 
    3180                                    double dfScale, 
    31813180                                   double dfFalseEasting, 
    31823181                                   double dfFalseNorthing ) 
    31833182 
    31843183{ 
    3185     SetProjection( SRS_PT_EQUIDISTANT_CYLINDRICAL_SHERE ); 
     3184    SetProjection( SRS_PT_EQUIRECTANGULAR ); 
    31863185    SetNormProjParm( SRS_PP_LATITUDE_OF_ORIGIN, dfCenterLat ); 
    31873186    SetNormProjParm( SRS_PP_CENTRAL_MERIDIAN, dfCenterLong ); 
    3188     SetNormProjParm( SRS_PP_SCALE_FACTOR, dfScale ); 
    31893187    SetNormProjParm( SRS_PP_FALSE_EASTING, dfFalseEasting ); 
    31903188    SetNormProjParm( SRS_PP_FALSE_NORTHING, dfFalseNorthing ); 
     3189    SetNormProjParm( SRS_PP_PSEUDO_STD_PARALLEL_1, dfCenterLat ); 
    31913190 
    31923191    return OGRERR_NONE; 
    31933192} 
    31943193 
    31953194/************************************************************************/ 
    3196 /*                       OSRSetEquidistantCylindricalSphere()           */ 
     3195/*                       OSRSetEquirectangular()                        */ 
    31973196/************************************************************************/ 
    31983197 
    3199 OGRErr OSRSetEquidistantCylindricalSphere( OGRSpatialReferenceH hSRS, 
    3200                                   double dfCenterLat, double dfCenterLong, 
    3201                                   double dfScale, 
    3202                                   double dfFalseEasting, 
    3203                                   double dfFalseNorthing ) 
    3204  
     3198OGRErr OSRSetEquirectangular( OGRSpatialReferenceH hSRS,  
     3199                              double dfCenterLat, double dfCenterLong, 
     3200                              double dfFalseEasting, 
     3201                              double dfFalseNorthing ) 
     3202     
    32053203{ 
    3206     return ((OGRSpatialReference *) hSRS)->SetEquidistantCylindricalSphere( 
    3207         dfCenterLat, dfCenterLong, dfScale, 
     3204    VALIDATE_POINTER1( hSRS, "OSRSetEquirectangular", CE_Failure ); 
     3205 
     3206    return ((OGRSpatialReference *) hSRS)->SetEquirectangular(  
     3207        dfCenterLat, dfCenterLong,  
    32083208        dfFalseEasting, dfFalseNorthing ); 
    32093209} 
    32103210 
    32113211/************************************************************************/ 
    3212 /*                         SetEquirectangular()                         */ 
     3212/*                         SetEquirectangular2()                        */ 
     3213/* Generalized form                                                     */ 
    32133214/************************************************************************/ 
    32143215 
    3215 OGRErr OGRSpatialReference::SetEquirectangular
     3216OGRErr OGRSpatialReference::SetEquirectangular2
    32163217                                   double dfCenterLat, double dfCenterLong, 
     3218                                   double dfPseudoStdParallel1, 
    32173219                                   double dfFalseEasting, 
    32183220                                   double dfFalseNorthing ) 
    32193221 
     
    32233225    SetNormProjParm( SRS_PP_CENTRAL_MERIDIAN, dfCenterLong ); 
    32243226    SetNormProjParm( SRS_PP_FALSE_EASTING, dfFalseEasting ); 
    32253227    SetNormProjParm( SRS_PP_FALSE_NORTHING, dfFalseNorthing ); 
     3228    SetNormProjParm( SRS_PP_PSEUDO_STD_PARALLEL_1, dfPseudoStdParallel1 ); 
    32263229 
    32273230    return OGRERR_NONE; 
    32283231} 
    32293232 
    32303233/************************************************************************/ 
    3231 /*                       OSRSetEquirectangular()                        */ 
     3234/*                       OSRSetEquirectangular2()                       */ 
    32323235/************************************************************************/ 
    32333236 
    3234 OGRErr OSRSetEquirectangular( OGRSpatialReferenceH hSRS,  
    3235                               double dfCenterLat, double dfCenterLong, 
    3236                               double dfFalseEasting, 
    3237                               double dfFalseNorthing ) 
     3237OGRErr OSRSetEquirectangular2( OGRSpatialReferenceH hSRS,  
     3238                               double dfCenterLat, double dfCenterLong, 
     3239                               double dfPseudoStdParallel1, 
     3240                               double dfFalseEasting, 
     3241                               double dfFalseNorthing ) 
    32383242     
    32393243{ 
    32403244    VALIDATE_POINTER1( hSRS, "OSRSetEquirectangular", CE_Failure ); 
    32413245 
    3242      return ((OGRSpatialReference *) hSRS)->SetEquirectangular(  
     3246     return ((OGRSpatialReference *) hSRS)->SetEquirectangular2(  
    32433247        dfCenterLat, dfCenterLong,  
     3248        dfPseudoStdParallel1, 
    32443249        dfFalseEasting, dfFalseNorthing ); 
    32453250} 
    32463251 
  • gdal-trunk/ogr/ogr_spatialref.h

    old new  
    306306    OGRErr      SetEckertVI( double dfCentralMeridian, 
    307307                             double dfFalseEasting, double dfFalseNorthing ); 
    308308 
    309     /** Equidistant Cylindrical Sphere */ 
    310     OGRErr      SetEquidistantCylindricalSphere(double dfCenterLat, double dfCenterLong, 
    311                             double dfScale, 
    312                             double dfFalseEasting, double dfFalseNorthing ); 
    313  
    314309    /** Equirectangular */ 
    315310    OGRErr      SetEquirectangular(double dfCenterLat, double dfCenterLong, 
    316311                            double dfFalseEasting, double dfFalseNorthing ); 
     312    /** Equirectangular generalized form : */ 
     313    OGRErr      SetEquirectangular2( double dfCenterLat, double dfCenterLong, 
     314                                     double dfPseudoStdParallel1, 
     315                                     double dfFalseEasting, double dfFalseNorthing ); 
    317316 
    318317    /** Geostationary Satellite */ 
    319318    OGRErr      SetGEOS( double dfCentralMeridian, double dfSatelliteHeight,  
  • gdal-trunk/ogr/ogr_srs_api.h

    old new  
    9696#define SRS_PT_ECKERT_VI        "Eckert_VI" 
    9797#define SRS_PT_EQUIDISTANT_CONIC                                        \ 
    9898                                "Equidistant_Conic" 
    99 #define SRS_PT_EQUIDISTANT_CYLINDRICAL_SHERE                            \ 
    100                                 "Equidistant_Cylindrical_Sphere" 
    10199#define SRS_PT_EQUIRECTANGULAR  "Equirectangular" 
    102100#define SRS_PT_GALL_STEREOGRAPHIC                                       \ 
    103101                                "Gall_Stereographic" 
     
    389387                       double dfCenterLat, double dfCenterLong, 
    390388                       double dfFalseEasting, double dfFalseNorthing ); 
    391389 
    392 /** Equidistant Cylindrical Sphere */ 
    393 OGRErr CPL_DLL OSRSetEquidistantCylindricalSphere( OGRSpatialReferenceH hSRS, 
    394                                   double dfCenterLat, double dfCenterLong, 
    395                                   double dfScale, 
    396                                   double dfFalseEasting, 
    397                                   double dfFalseNorthing ); 
    398  
    399390/** Eckert I-VI */ 
    400391OGRErr CPL_DLL OSRSetEckert( OGRSpatialReferenceH hSRS,  int nVariation, 
    401392                             double dfCentralMeridian, 
     
    414405                              double dfCenterLat, double dfCenterLong, 
    415406                              double dfFalseEasting, double dfFalseNorthing ); 
    416407 
     408/** Equirectangular generalized form */ 
     409OGRErr CPL_DLL OSRSetEquirectangular2( OGRSpatialReferenceH hSRS, 
     410                              double dfCenterLat, double dfCenterLong, 
     411                              double dfPseudoStdParallel1, 
     412                              double dfFalseEasting, 
     413                              double dfFalseNorthing ); 
     414 
    417415/** Gall Stereograpic */ 
    418416OGRErr CPL_DLL OSRSetGS( OGRSpatialReferenceH hSRS, double dfCentralMeridian, 
    419417                       double dfFalseEasting, double dfFalseNorthing ); 
     
    427425                           double dfCentralMeridian, double dfSatelliteHeight, 
    428426                           double dfFalseEasting, double dfFalseNorthing ); 
    429427 
    430 /** GaussLabordeReunion */     
     428/** Gauss Laborde Reunion */     
    431429OGRErr CPL_DLL OSRSetGaussLabordeReunion( OGRSpatialReferenceH hSRS, 
    432430                                  double dfCenterLat, double dfCenterLong, 
    433431                                  double dfScale, 
  • gdal-trunk/ogr/ogr_srs_proj4.cpp

    old new  
    480480 
    481481    else if( EQUAL(pszProj,"eqc") ) 
    482482    { 
    483         SetEquirectangular( OSR_GDV( papszNV, "lat_ts", 0.0 ),  
    484                             OSR_GDV( papszNV, "lon_0", 0.0 ),  
    485                             OSR_GDV( papszNV, "x_0", 0.0 ),  
    486                             OSR_GDV( papszNV, "y_0", 0.0 ) ); 
    487     } 
    488  
    489     else if( EQUAL(pszProj,"eqr") ) 
    490     { 
    491         SetEquidistantCylindricalSphere( OSR_GDV( papszNV, "lat_ts", 0.0 ), 
    492                                          OSR_GDV( papszNV, "lon_0", 0.0 )+dfFromGreenwich, 
    493                                          OSR_GDV( papszNV, "k_0", 6378137.0 ), 
    494                                          OSR_GDV( papszNV, "x_0", 0.0 ), 
    495                                          OSR_GDV( papszNV, "y_0", 0.0 ) ); 
     483        if( OSR_GDV( papszNV, "lat_0", 0.0 ) != OSR_GDV( papszNV, "lat_ts", 0.0 ) ) 
     484          SetEquirectangular2( OSR_GDV( papszNV, "lat_ts", 0.0 ), 
     485                               OSR_GDV( papszNV, "lon_0", 0.0 )+dfFromGreenwich, 
     486                               OSR_GDV( papszNV, "lat_ts", 0.0 ), 
     487                               OSR_GDV( papszNV, "x_0", 0.0 ), 
     488                               OSR_GDV( papszNV, "y_0", 0.0 ) ); 
     489        else 
     490          SetEquirectangular( OSR_GDV( papszNV, "lat_ts", 0.0 ), 
     491                              OSR_GDV( papszNV, "lon_0", 0.0 )+dfFromGreenwich, 
     492                              OSR_GDV( papszNV, "x_0", 0.0 ), 
     493                              OSR_GDV( papszNV, "y_0", 0.0 ) ); 
    496494    } 
    497495 
    498496   else if( EQUAL(pszProj,"glabsgm") ) 
     
    12191217                     GetNormProjParm(SRS_PP_FALSE_NORTHING,0.0) ); 
    12201218    } 
    12211219 
    1222     else if( EQUAL(pszProjection,SRS_PT_EQUIDISTANT_CYLINDRICAL_SHERE) ) 
    1223     { 
    1224         sprintf( szProj4+strlen(szProj4), 
    1225                  "+proj=eqr +lat_ts=%.16g +lon_0=%.16g +k_0=%.16g +x_0=%.16g +y_0=%.16g ", 
    1226                  GetNormProjParm(SRS_PP_LATITUDE_OF_ORIGIN,0.0), 
    1227                  GetNormProjParm(SRS_PP_CENTRAL_MERIDIAN,0.0), 
    1228                  GetNormProjParm(SRS_PP_SCALE_FACTOR,6378137.0), 
    1229                  GetNormProjParm(SRS_PP_FALSE_EASTING,0.0), 
    1230                  GetNormProjParm(SRS_PP_FALSE_NORTHING,0.0) ); 
    1231     } 
    1232  
    12331220    else if( EQUAL(pszProjection,SRS_PT_EQUIRECTANGULAR) ) 
    12341221    { 
    12351222        sprintf( szProj4+strlen(szProj4), 
    1236                  "+proj=eqc +lat_ts=%.16g +lon_0=%.16g +x_0=%.16g +y_0=%.16g ", 
     1223                 "+proj=eqc +lat_ts=%.16g +lat_0=%.16g +lon_0=%.16g +x_0=%.16g +y_0=%.16g ", 
     1224                 GetNormProjParm(SRS_PP_PSEUDO_STD_PARALLEL_1, 
     1225                                 GetNormProjParm(SRS_PP_LATITUDE_OF_ORIGIN,0.0)), 
    12371226                 GetNormProjParm(SRS_PP_LATITUDE_OF_ORIGIN,0.0), 
    12381227                 GetNormProjParm(SRS_PP_CENTRAL_MERIDIAN,0.0), 
    12391228                 GetNormProjParm(SRS_PP_FALSE_EASTING,0.0), 
  • gdal-trunk/swig/include/csharp/ogr_srs_const.h

    old new  
    5151#define SRS_PT_EQUIDISTANT_CONIC "Equidistant_Conic" 
    5252#define SRS_PT_EQUIRECTANGULAR  "Equirectangular" 
    5353#define SRS_PT_GALL_STEREOGRAPHIC "Gall_Stereographic" 
     54#define SRS_PT_GAUSSLABORDEREUNION                                      \ 
     55                                "Gauss_Laborde_Sphere_Geometric_Mean" 
    5456#define SRS_PT_GEOSTATIONARY_SATELLITE "Geostationary_Satellite" 
    5557#define SRS_PT_GOODE_HOMOLOSINE "Goode_Homolosine" 
    5658#define SRS_PT_GNOMONIC         "Gnomonic" 
  • gdal-trunk/swig/include/osr.i

    old new  
    5454%constant char *SRS_PT_ECKERT_IV                = SRS_PT_ECKERT_IV; 
    5555%constant char *SRS_PT_ECKERT_VI                = SRS_PT_ECKERT_VI; 
    5656%constant char *SRS_PT_EQUIDISTANT_CONIC        = SRS_PT_EQUIDISTANT_CONIC; 
    57 %constant char *SRS_PT_EQUIDISTANT_CYLINDRICAL_SHERE = SRS_PT_EQUIDISTANT_CYLINDRICAL_SHERE; 
    5857%constant char *SRS_PT_EQUIRECTANGULAR          = SRS_PT_EQUIRECTANGULAR; 
    5958%constant char *SRS_PT_GALL_STEREOGRAPHIC       = SRS_PT_GALL_STEREOGRAPHIC; 
    6059%constant char *SRS_PT_GAUSSLABORDEREUNION      = SRS_PT_GAUSSLABORDEREUNION; 
     
    448447                                  fe, fn ); 
    449448  } 
    450449 
    451 %feature( "kwargs" ) SetEquidistantCylindricalSphere; 
    452   OGRErr SetEquidistantCylindricalSphere( double clat, double clong, double sc, double fe, double fn ) { 
    453     return OSRSetEquidistantCylindricalSphere( self, clat, clong, sc, fe, fn ); 
    454   } 
     450%feature( "kwargs" ) SetEquirectangular2; 
     451  OGRErr SetEquirectangular2( double clat, double clong, 
     452                              double pseudostdparallellat, 
     453                              double fe, double fn ) { 
     454    return OSRSetEquirectangular2( self, clat, clong, 
     455                                   pseudostdparallellat, 
     456                                   fe, fn ); 
    455457 
    456458%feature( "kwargs" ) SetGaussLabordeReunion; 
    457459  OGRErr SetGaussLabordeReunion( double clat, double clong, double sc, double fe, double fn ) {