[OSRS-PROJ] geod_api

Alan Forster Alan.Forster at mouchel.com
Sat Jun 1 10:07:48 EDT 2002


Thank you for your e-mail.

I am on leave until 10th June and will reply when I get back!

Regards,

Alan.

>>> osrs-proj 06/01/02 14:59 >>>

Thank you for your e-mail.

I am on leave until 10th June and will reply when I get back!

Regards,

Alan.

>>> osrs-proj 06/01/02 14:47 >>>

Thank you for your e-mail.

I am on leave until 10th June and will reply when I get back!

Regards,

Alan.

>>> osrs-proj 06/01/02 14:33 >>>

Hi Folks,

I work on earthquake relocations at university of potsdam and try to 
change the
coordinate  transformation routines of the USGS to ellipsoid and datum 
variable
routines. Therfore i encapsulate then proj code into a "Transformer 
Class" and
it works well. See ANHANG:

Now iI use also great circle computations to applicate perhaps the 
azimut angle
to the normal correction vectors  of a earthquake event. The routines 
are fixed to
WGS 72 ellipsoid and I want to use the parameter settings like the 
routine GEOD
to create similar Container class.

My question, is there a geod_api.h available like the proj_api.h to 
realize this
or must I investigate the programming code of the geod.c tool.

With friendly geetings A. Weidauer 


I try to create  a class container  for proj tools like this :

ANHANG:

//--- uCoordinates.hpp ----------------------------------------------------
#include "uConst.hpp"
#include "uObject.hpp"
#include <proj_api.h>
 
class cCoordinateTransformer : private cObject {
private:
 projUV p;
 projPJ PlainLL;
 projPJ Src,Dst;
 void SetCoordSystem(const char* aProjection, projPJ& pj);
public:
 cCoordinateTransformer();
 ~cCoordinateTransformer();

 void SetPlainLLSystem(const char* aProjection);
 void SetPlainSrcSystem(const char* aProjection);
 void SetPlainDestSystem(const char* aProjection);

 void cvsLLToPlain (tDouble Longitude,
                    tDouble Latitude,       
                    tDouble& XDistanceKM,
            tDouble& YDistanceKM);     

 void cvsPlainToLL(tDouble XDistanceKM,
                    tDouble YDistanceKM,
                    tDouble& Longitude,
                    tDouble& Latitude);

 void cvsPlainToPlain(tDouble XSourceKM, tDouble YSourceKM,
                      tDouble XDestKM,   tDouble YDestKM);
};
typedef  cCoordinateTransformer*  rCoordinateTransformer; 

// --- Class implementation 
---------------------------------------------------------------
 cCoordinateTransformer::cCoordinateTransformer(): cObject() {
  PlainLL=NULL;
  Src=NULL;
  Dst=NULL;
 }
 
 //-----------------------------------------------------------------------
 cCoordinateTransformer::~cCoordinateTransformer() {
  if (PlainLL!=NULL) {  pj_free(PlainLL); }
  if (Src!=NULL)  {  pj_free(Src); }
  if (Dst!=NULL) {  pj_free(Dst); }
 }
//-----------------------------------------------------------------------
void cCoordinateTransformer::SetCoordSystem(const char* aProjection, 
projPJ& pj)
{ char buffer[512];
  if (pj!=NULL) { pj_free(pj);}
  pj = pj_init_plus(aProjection);
  if (pj==NULL) {
   sprintf(buffer,"Cannot set projection \"%s\" !",aProjection);
   FatalError(-1,buffer);
  }
}       

//-----------------------------------------------------------------------
void cCoordinateTransformer::SetPlainLLSystem(const char* aProjection)
{ SetCoordSystem(aProjection,PlainLL); }       
//-----------------------------------------------------------------------
void cCoordinateTransformer::SetPlainSrcSystem(const char* aProjection)
{ SetCoordSystem(aProjection,Src); }       
//-----------------------------------------------------------------------
void cCoordinateTransformer::SetPlainDestSystem(const char* aProjection)
{ SetCoordSystem(aProjection,Dst); }       

 //-----------------------------------------------------------------------
 void cCoordinateTransformer::cvsLLToPlain(tDouble Longitude,
                    tDouble Latitude,       
                    tDouble& XKM,
            tDouble& YKM)   
{
    if (PlainLL==NULL) {
      FatalError(-1," lon lat to plain transformer ! Coordinate system 
not specified !");
    }
    p.u = DEG_TO_RAD * Longitude;
    p.v = DEG_TO_RAD * Latitude;
    p = pj_fwd(p, PlainLL);
    XKM = p.u/1000;
    YKM = p.v/1000;
}       
 //-----------------------------------------------------------------------
 //-----------------------------------------------------------------------
 void cCoordinateTransformer::cvsPlainToLL(tDouble XKM,
                    tDouble YKM,
                    tDouble& Longitude,
                    tDouble& Latitude)
 {
    if (PlainLL==NULL) {
      FatalError(-1," lon lat to plain transformer ! Coordinate system 
not specified !");
    }
    p.u = XKM*1000;
    p.v = YKM*1000;
    p = pj_inv(p, PlainLL);
    XKM = p.u * RAD_TO_DEG;
    YKM = p.v * RAD_TO_DEG;
 }
 //-----------------------------------------------------------------------
 void cCoordinateTransformer::cvsPlainToPlain(tDouble XSourceKM, tDouble 
YSourceKM,
                                              tDouble XDestKM,   tDouble 
YDestKM)
 { 
   
    if (Src==NULL) {
      FatalError(-1," lon lat to plain transformer ! Source coordinate 
system not specified !");
    }
    if (Dst==NULL) {
      FatalError(-1," lon lat to plain transformer ! Source coordinate 
system not specified !");
    }
    p.u = XSourceKM*1000.0;
    p.v = YSourceKM*1000.0;
    p=pj_inv(p,Src);
    p=pj_fwd(p,Dst);
    XDestKM = p.u *1000.0;
    YDestKM = p.v *1000.0;
 }
 

----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.

----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.

----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.

----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.



More information about the Proj mailing list