From 4520e700636f4c98603324541121334de75daa7d Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 16 Feb 2012 00:25:48 +0000 Subject: [PATCH] Prepare for Proj4.8 with spheroid info handling git-svn-id: http://svn.osgeo.org/postgis/trunk@9214 b70326c6-7e19-0410-871a-916f4a2858ee --- libpgcommon/lwgeom_transform.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c index 9cd777801..91fdf7e51 100644 --- a/libpgcommon/lwgeom_transform.c +++ b/libpgcommon/lwgeom_transform.c @@ -710,8 +710,8 @@ GetProjectionsUsingFCInfo(FunctionCallInfo fcinfo, int srid1, int srid2, projPJ int spheroid_init_from_srid(FunctionCallInfo fcinfo, int srid, SPHEROID *s) { - projPJ pj1; - projPJ pj2; + projPJ pj1, pj2; + double major_axis, minor_axis, eccentricity_squared; if ( GetProjectionsUsingFCInfo(fcinfo, srid, srid, &pj1, &pj2) == LW_FAILURE) return LW_FAILURE; @@ -723,7 +723,9 @@ spheroid_init_from_srid(FunctionCallInfo fcinfo, int srid, SPHEROID *s) /* For newer versions of Proj we can pull the spheroid paramaeters and initialize */ /* using them */ /* TODO actually implement this using the API function when it exists */ - spheroid_init(s, WGS84_MAJOR_AXIS, WGS84_MINOR_AXIS); + pj_get_spheroid_defn(pj1, &major_axis, &eccentricity_squared); + minor_axis = major_axis * sqrt(1-eccentricity_squared); + spheroid_init(s, major_axis, minor_axis); #else /* For old versions of Proj we cannot lookup the spheroid parameters from the API */ /* So we use the WGS84 parameters (boo!) */ -- 2.40.0