diff options
| author | Frank Warmerdam <warmerdam@pobox.com> | 2002-12-14 20:16:51 +0000 |
|---|---|---|
| committer | Frank Warmerdam <warmerdam@pobox.com> | 2002-12-14 20:16:51 +0000 |
| commit | e3d233f92c5ad99f2c17726252c613d9da9ae966 (patch) | |
| tree | 1309bd3b74437bf5f642faa32b6f27e2ae4b485c /src/pj_transform.c | |
| parent | e8958c284a5c9f336c08c03f150b273acd3dae79 (diff) | |
| download | PROJ-e3d233f92c5ad99f2c17726252c613d9da9ae966.tar.gz PROJ-e3d233f92c5ad99f2c17726252c613d9da9ae966.zip | |
added geocentric support
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1057 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src/pj_transform.c')
| -rw-r--r-- | src/pj_transform.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/pj_transform.c b/src/pj_transform.c index a6c9aee3..1b4092b8 100644 --- a/src/pj_transform.c +++ b/src/pj_transform.c @@ -5,7 +5,7 @@ * Purpose: Perform overall coordinate system to coordinate system * transformations (pj_transform() function) including reprojection * and datum shifting. - * Author: Frank Warmerdam, warmerda@home.com + * Author: Frank Warmerdam, warmerdam@pobox.com * ****************************************************************************** * Copyright (c) 2000, Frank Warmerdam @@ -30,6 +30,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.7 2002/12/14 20:14:35 warmerda + * added geocentric support + * * Revision 1.6 2002/12/09 16:01:02 warmerda * added prime meridian support * @@ -55,6 +58,8 @@ #include <math.h> #include "geocent.h" +PJ_CVSID("$Id$"); + #ifndef SRS_WGS84_SEMIMAJOR #define SRS_WGS84_SEMIMAJOR 6378137.0 #endif @@ -93,10 +98,24 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, point_offset = 1; /* -------------------------------------------------------------------- */ +/* Transform geocentric source coordinates to lat/long. */ +/* -------------------------------------------------------------------- */ + if( srcdefn->is_geocent ) + { + if( z == NULL ) + { + pj_errno = PJD_ERR_GEOCENTRIC; + return PJD_ERR_GEOCENTRIC; + } + + pj_geocentric_to_geodetic( srcdefn->a, srcdefn->es, + point_count, point_offset, x, y, z ); + } +/* -------------------------------------------------------------------- */ /* Transform source points to lat/long, if they aren't */ /* already. */ /* -------------------------------------------------------------------- */ - if( !srcdefn->is_latlong ) + else if( !srcdefn->is_latlong ) { for( i = 0; i < point_count; i++ ) { @@ -132,10 +151,25 @@ int pj_transform( PJ *srcdefn, PJ *dstdefn, long point_count, int point_offset, return pj_errno; /* -------------------------------------------------------------------- */ +/* Transform destination latlong to geocentric if required. */ +/* -------------------------------------------------------------------- */ + if( dstdefn->is_geocent ) + { + if( z == NULL ) + { + pj_errno = PJD_ERR_GEOCENTRIC; + return PJD_ERR_GEOCENTRIC; + } + + pj_geodetic_to_geocentric( dstdefn->a, dstdefn->es, + point_count, point_offset, x, y, z ); + } + +/* -------------------------------------------------------------------- */ /* Transform destination points to projection coordinates, if */ /* desired. */ /* -------------------------------------------------------------------- */ - if( !dstdefn->is_latlong ) + else if( !dstdefn->is_latlong ) { for( i = 0; i < point_count; i++ ) { |
