From b52b9b9cf9a3ae13a29febfb8df574fff1d88027 Mon Sep 17 00:00:00 2001 From: Frank Warmerdam Date: Wed, 15 Feb 2012 23:51:45 +0000 Subject: added pj_get_spheroid_defn() (#142) git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2160 4e78687f-474d-0410-85f9-8d5e500ac6b2 --- src/pj_utils.c | 17 +++++++++++++++++ src/proj_api.h | 1 + 2 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/pj_utils.c b/src/pj_utils.c index 15adcd93..f3d642ad 100644 --- a/src/pj_utils.c +++ b/src/pj_utils.c @@ -154,3 +154,20 @@ PJ *pj_latlong_from_proj( PJ *pj_in ) return pj_init_plus_ctx( pj_in->ctx, defn ); } +/************************************************************************/ +/* pj_get_spheroid_defn() */ +/* */ +/* Fetch the internal definition of the spheroid. Note that */ +/* you can compute "b" from eccentricity_squared as: */ +/* */ +/* b = a * sqrt(1 - es) */ +/************************************************************************/ + +void pj_get_spheroid_defn(projPJ defn, double *major_axis, double *eccentricity_squared) +{ + if ( major_axis ) + *major_axis = defn->a; + + if ( eccentricity_squared ) + *eccentricity_squared = defn->es; +}; diff --git a/src/proj_api.h b/src/proj_api.h index 739a09bd..feae9aff 100644 --- a/src/proj_api.h +++ b/src/proj_api.h @@ -86,6 +86,7 @@ void pj_deallocate_grids(void); void pj_clear_initcache(void); int pj_is_latlong(projPJ); int pj_is_geocent(projPJ); +void pj_get_spheroid_defn(projPJ defn, double *major_axis, double *eccentricity_squared); void pj_pr_list(projPJ); void pj_free(projPJ); void pj_set_finder( const char *(*)(const char *) ); -- cgit v1.2.3