ogr/ogr_fromepsg.cpp
static int 
EPSGGetEllipsoidInfo( int nCode, char ** ppszName,
                      double * pdfSemiMajor, double * pdfInvFlattening )

{
    char        szSearchKey[24];
    double      dfSemiMajor, dfToMeters = 1.0;
    int         nUOMLength;
    
/* -------------------------------------------------------------------- */
/*      Get the semi major axis.                                        */
/* -------------------------------------------------------------------- */
    sprintf( szSearchKey, "%d", nCode );

    dfSemiMajor =
        atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
                          "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                          "SEMI_MAJOR_AXIS" ) );
    if( dfSemiMajor == 0.0 )
        return FALSE;

/* -------------------------------------------------------------------- */
/*      Get the translation factor into meters.                         */
/* -------------------------------------------------------------------- */
    nUOMLength = atoi(CSVGetField( CSVFilename("ellipsoid.csv" ),
                                   "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                                   "UOM_CODE" ));
    EPSGGetUOMLengthInfo( nUOMLength, NULL, &dfToMeters );

    dfSemiMajor *= dfToMeters;
    
    if( pdfSemiMajor != NULL )
        *pdfSemiMajor = dfSemiMajor;
    
/* -------------------------------------------------------------------- */
/*      Get the semi-minor if requested.  If the Semi-minor axis        */
/*      isn't available, compute it based on the inverse flattening.    */
/* -------------------------------------------------------------------- */
    if( pdfInvFlattening != NULL )
    {
        *pdfInvFlattening = 
            atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
                              "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                              "INV_FLATTENING" ));

        if( *pdfInvFlattening == 0.0 )
        {
            double dfSemiMinor;

            dfSemiMinor =
                atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
                                  "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                                  "SEMI_MINOR_AXIS" )) * dfToMeters;

            if( dfSemiMajor != 0.0 && dfSemiMajor != dfSemiMinor )
                *pdfInvFlattening = 
                    -1.0 / (dfSemiMinor/dfSemiMajor - 1.0);
            else
                *pdfInvFlattening = 0.0;
        }
    }

/* -------------------------------------------------------------------- */
/*      Get the name, if requested.                                     */
/* -------------------------------------------------------------------- */
    if( ppszName != NULL )
        *ppszName =
            CPLStrdup(CSVGetField( CSVFilename("ellipsoid.csv" ),
                                   "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                                   "ELLIPSOID_NAME" ));
    
    return( TRUE );
}
/************************************************************************/
/*                        EPSGGetEllipsoidInfo()                        */
/*                                                                      */
/*      Fetch info about an ellipsoid.  Axes are always returned in     */
/*      meters.  SemiMajor computed based on inverse flattening         */
/*      where that is provided.                                         */
/************************************************************************/
EPSGGetEllipsoidInfo()
Fetch info about an ellipsoid.  Axes are always returned in
meters.  SemiMajor computed based on inverse flattening
where that is provided.
EPSGGetEllipsoidInfo () Fetch info about an ellipsoid . Axes are always returned in meters . SemiMajor computed based on inverse flattening where that is provided .
static int 
EPSGGetEllipsoidInfo( int nCode, char ** ppszName,
                      double * pdfSemiMajor, double * pdfInvFlattening )
{
    char        szSearchKey[24];
    double      dfSemiMajor, dfToMeters = 1.0;
    int         nUOMLength;
    sprintf( szSearchKey, "%d", nCode );
    dfSemiMajor =
        atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
                          "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                          "SEMI_MAJOR_AXIS" ) );
    if( dfSemiMajor == 0.0 )
        return FALSE;
    nUOMLength = atoi(CSVGetField( CSVFilename("ellipsoid.csv" ),
                                   "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                                   "UOM_CODE" ));
    EPSGGetUOMLengthInfo( nUOMLength, NULL, &dfToMeters );
    dfSemiMajor *= dfToMeters;
    if( pdfSemiMajor != NULL )
        *pdfSemiMajor = dfSemiMajor;
    if( pdfInvFlattening != NULL )
    {
        *pdfInvFlattening = 
            atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
                              "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                              "INV_FLATTENING" ));
        if( *pdfInvFlattening == 0.0 )
        {
            double dfSemiMinor;
            dfSemiMinor =
                atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
                                  "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                                  "SEMI_MINOR_AXIS" )) * dfToMeters;
            if( dfSemiMajor != 0.0 && dfSemiMajor != dfSemiMinor )
                *pdfInvFlattening = 
                    -1.0 / (dfSemiMinor/dfSemiMajor - 1.0);
            else
                *pdfInvFlattening = 0.0;
        }
    }
    if( ppszName != NULL )
        *ppszName =
            CPLStrdup(CSVGetField( CSVFilename("ellipsoid.csv" ),
                                   "ELLIPSOID_CODE", szSearchKey, CC_Integer,
                                   "ELLIPSOID_NAME" ));
    return( TRUE );
}
static int EPSGGetEllipsoidInfo ( int nCode , char * * ppszName , double * pdfSemiMajor , double * pdfInvFlattening ) { char szSearchKey [ 24 ] ; double dfSemiMajor , dfToMeters = 1.0 ; int nUOMLength ; sprintf ( szSearchKey , " " , nCode ) ; dfSemiMajor = atof ( CSVGetField ( CSVFilename ( " " ) , " " , szSearchKey , CC_Integer , " " ) ) ; if ( dfSemiMajor == 0.0 ) return FALSE ; nUOMLength = atoi ( CSVGetField ( CSVFilename ( " " ) , " " , szSearchKey , CC_Integer , " " ) ) ; EPSGGetUOMLengthInfo ( nUOMLength , NULL , & dfToMeters ) ; dfSemiMajor *= dfToMeters ; if ( pdfSemiMajor != NULL ) * pdfSemiMajor = dfSemiMajor ; if ( pdfInvFlattening != NULL ) { * pdfInvFlattening = atof ( CSVGetField ( CSVFilename ( " " ) , " " , szSearchKey , CC_Integer , " " ) ) ; if ( * pdfInvFlattening == 0.0 ) { double dfSemiMinor ; dfSemiMinor = atof ( CSVGetField ( CSVFilename ( " " ) , " " , szSearchKey , CC_Integer , " " ) ) * dfToMeters ; if ( dfSemiMajor != 0.0 && dfSemiMajor != dfSemiMinor ) * pdfInvFlattening = -1.0 / ( dfSemiMinor / dfSemiMajor - 1.0 ) ; else * pdfInvFlattening = 0.0 ; } } if ( ppszName != NULL ) * ppszName = CPLStrdup ( CSVGetField ( CSVFilename ( " " ) , " " , szSearchKey , CC_Integer , " " ) ) ; return ( TRUE ) ; }
EPSGGetEllipsoidInfo()
Fetch info about an ellipsoid.
EPSGGetEllipsoidInfo () Fetch info about an ellipsoid .
/* -------------------------------------------------------------------- */ /*      Get the semi major axis.                                        */ /* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */ /*      Get the translation factor into meters.                         */ /* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */ /*      Get the semi-minor if requested.  If the Semi-minor axis        */ /*      isn't available, compute it based on the inverse flattening.    */ /* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */ /*      Get the name, if requested.                                     */ /* -------------------------------------------------------------------- */