diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/makefile.vc | 2 | ||||
| -rw-r--r-- | src/pj_list.h | 1 | ||||
| -rw-r--r-- | src/pj_transform.c | 40 | ||||
| -rw-r--r-- | src/proj_api.h | 4 |
4 files changed, 43 insertions, 4 deletions
diff --git a/src/makefile.vc b/src/makefile.vc index 9041d32a..c68c1ef9 100644 --- a/src/makefile.vc +++ b/src/makefile.vc @@ -36,7 +36,7 @@ misc = \ PJ_chamb.obj PJ_hammer.obj PJ_lagrng.obj PJ_larr.obj \ PJ_lask.obj PJ_nocol.obj PJ_ob_tran.obj PJ_oea.obj \ PJ_tpeqd.obj PJ_vandg.obj PJ_vandg2.obj PJ_vandg4.obj \ - PJ_wag7.obj pj_latlong.obj PJ_krovak.obj + PJ_wag7.obj pj_latlong.obj PJ_krovak.obj pj_geocent.obj pseudo = \ PJ_boggs.obj PJ_collg.obj PJ_crast.obj PJ_denoy.obj \ diff --git a/src/pj_list.h b/src/pj_list.h index 57788666..f9969c49 100644 --- a/src/pj_list.h +++ b/src/pj_list.h @@ -36,6 +36,7 @@ PROJ_HEAD(fahey, "Fahey") PROJ_HEAD(fouc, "Foucaut") PROJ_HEAD(fouc_s, "Foucaut Sinusoidal") PROJ_HEAD(gall, "Gall (Gall Stereographic)") +PROJ_HEAD(geocent, "Geocentric") PROJ_HEAD(gins8, "Ginsburg VIII (TsNIIGAiK)") PROJ_HEAD(gn_sinu, "General Sinusoidal Series") PROJ_HEAD(gnom, "Gnomonic") 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++ ) { diff --git a/src/proj_api.h b/src/proj_api.h index 3adbd58e..b9fc167e 100644 --- a/src/proj_api.h +++ b/src/proj_api.h @@ -28,6 +28,9 @@ ****************************************************************************** * * $Log$ + * Revision 1.7 2002/12/14 20:14:35 warmerda + * added geocentric support + * * Revision 1.6 2002/06/11 18:08:25 warmerda * Added the pj_get_def() function * @@ -103,6 +106,7 @@ int pj_apply_gridshift( const char *, int, double *x, double *y, double *z ); void pj_deallocate_grids(); int pj_is_latlong(projPJ); +int pj_is_geocent(projPJ); void pj_pr_list(projPJ); void pj_free(projPJ); void pj_set_finder( const char *(*)(const char *) ); |
