Example #1
0
// Initialize the Lambert Conformal Conic projection
long Projectoid::lamccinvint(
double r_maj,                           // major axis
double r_min,                           // minor axis
double lat1,                            // first standard parallel
double lat2,                            // second standard parallel
double c_lon,                           // center longitude
double c_lat,                           // center latitude
double false_east,                      // x offset in meters
double false_north)                     // y offset in meters
{
double sin_po;                          // sin value
double cos_po;                          // cos value
double con;                             // temporary sin value
double ms1;                             // small m 1
double ms2;                             // small m 2
double temp;                            // temporary variable
double ts0;                             // small t 0
double ts1;                             // small t 1
double ts2;                             // small t 2

r_major = r_maj;
r_minor = r_min;
false_easting = false_east;
false_northing = false_north;

// Standard Parallels cannot be equal and on opposite sides of the equator
if (fabs(lat1 + lat2) < EPSLN)
	{
	p_error("Equal Latitiudes for St. Parallels on opposite sides of equator", "lamcc-inv");
	return(41);
	}

temp = r_minor / r_major;
es = 1.0 - SQUARE(temp);
e = sqrt(es);

center_lon = c_lon;
center_lat = c_lat;
sincos(lat1, &sin_po, &cos_po);
con = sin_po;
ms1 = msfnz(e, sin_po, cos_po);
ts1 = tsfnz(e, lat1, sin_po);
sincos(lat2, &sin_po, &cos_po);
ms2 = msfnz(e, sin_po, cos_po);
ts2 = tsfnz(e, lat2, sin_po);
sin_po = sin(center_lat);
ts0 = tsfnz(e, center_lat, sin_po);

if (fabs(lat1 - lat2) > EPSLN)
	ns = log(ms1 / ms2) / log(ts1 / ts2);
else
	ns = con;
f0 = ms1 / (ns * pow(ts1, ns));
rh = r_major * f0 * pow(ts0, ns);

// Report parameters to the user
ptitle("LAMBERT CONFORMAL CONIC"); 
radius2(r_major, r_minor);
stanparl(lat1, lat2);
cenlonmer(center_lon);
origin(c_lat);
offsetp(false_easting, false_northing);
InverseOK[WCS_PROJECTIONCODE_LAMCC] = 1;
InverseTransform = &Projectoid::lamccinv;

return(OK);

}
Example #2
0
/* Initialize the Equidistant Conic projection
  ------------------------------------------*/
int eqconinvint(
double r_maj,			/* major axis			*/
double r_min,			/* minor axis			*/
double lat1,			/* latitude of standard parallel*/
double lat2,			/* latitude of standard parallel*/
double center_lon,		/* center longitude		*/
double center_lat,		/* center latitude		*/
double false_east,		/* x offset in meters		*/
double false_north,		/* y offset in meters		*/
long   mode)			/* which format is present A B	*/
{
double temp;			/* temporary variable		*/
double sinphi,cosphi;		/* sin and cos values		*/
double ms1,ms2;
double ml1,ml2;

/* Place parameters in static storage for common use
  -------------------------------------------------*/
r_major = r_maj;
r_minor = r_min;
lon_center = center_lon;
false_northing = false_north;
false_easting = false_east;

temp = r_minor / r_major;
es = 1.0 - SQUARE(temp);
e = sqrt(es);
e0 = e0fn(es);
e1 = e1fn(es);
e2 = e2fn(es);
e3 = e3fn(es);

tsincos(lat1,&sinphi,&cosphi);
ms1 = msfnz(e,sinphi,cosphi);
ml1 = mlfn(e0, e1, e2, e3, lat1);

/* format B
---------*/
if (mode != 0)
   {
   if (fabs(lat1 + lat2) < EPSLN)
      {
      p_error("Standard Parallels on opposite sides of equator","eqcon-for");
      return(81);
      }
   tsincos(lat2,&sinphi,&cosphi);
   ms2 = msfnz(e,sinphi,cosphi);
   ml2 = mlfn(e0, e1, e2, e3, lat2);
   if (fabs(lat1 - lat2) >= EPSLN)
      ns = (ms1 - ms2) / (ml2 - ml1);
   else
      ns = sinphi;
   }
else
   ns = sinphi;
g = ml1 + ms1/ns;
ml0 = mlfn(e0, e1, e2, e3, center_lat);
rh = r_major * (g - ml0);
   

/* Report parameters to the user
  -----------------------------*/
if (mode != 0)
   {
   ptitle("EQUIDISTANT CONIC"); 
   radius2(r_major, r_minor);
   stanparl(lat1,lat2);
   cenlonmer(lon_center);
   origin(center_lat);
   offsetp(false_easting,false_northing);
   }
else 
   {
   ptitle("EQUIDISTANT CONIC"); 
   radius2(r_major, r_minor);
   stparl1(lat1);
   cenlonmer(lon_center);
   origin(center_lat);
   offsetp(false_easting,false_northing);
   }

return(OK);
}
Example #3
0
/* Initialize the Albers projection
  -------------------------------*/
int alberinvint(
double r_maj,                   /* major axis                           */
double r_min,                   /* minor axis                           */
double lat1,                    /* first standard parallel              */
double lat2,                    /* second standard parallel             */
double lon0,                    /* center longitude                     */
double lat0,                    /* center lattitude                     */
double false_east,              /* x offset in meters                   */
double false_north)             /* y offset in meters                   */
{
double sin_po,cos_po;		/* sine and cos values			*/
double con;			/* temporary variable			*/
double temp;			/* temporary variable			*/
double ms1;   		        /* small m 1                            */
double ms2;            		/* small m 2                            */
double qs0;            		/* small q 0                            */
double qs1;            		/* small q 1                            */
double qs2;            		/* small q 2                            */

false_easting = false_east;
false_northing = false_north;
lon_center = lon0;
if (fabs(lat1 + lat2) < EPSLN)
   {
  p_error("Equal latitudes for Standard Parallels on opposite sides of equator"
	  ,"alber-invinit");
   return(31);
   }
r_major = r_maj;
r_minor = r_min;
temp = r_minor / r_major;
es = 1.0 - SQUARE(temp);
e3 = sqrt(es);

tsincos(lat1, &sin_po, &cos_po);
con = sin_po;

ms1 = msfnz(e3,sin_po,cos_po);
qs1 = qsfnz(e3,sin_po,cos_po);

tsincos(lat2,&sin_po,&cos_po);

ms2 = msfnz(e3,sin_po,cos_po);
qs2 = qsfnz(e3,sin_po,cos_po);

tsincos(lat0,&sin_po,&cos_po);

qs0 = qsfnz(e3,sin_po,cos_po);

if (fabs(lat1 - lat2) > EPSLN)
   ns0 = (ms1 * ms1 - ms2 *ms2)/ (qs2 - qs1);
else
   ns0 = con;
c = ms1 * ms1 + ns0 * qs1;
rh = r_major * sqrt(c - ns0 * qs0)/ns0;

/* Report parameters to the user
  -----------------------------*/
ptitle("ALBERS CONICAL EQUAL-AREA");
radius2(r_major, r_minor);
stanparl(lat1,lat2);
cenlonmer(lon_center);
origin(lat0);
offsetp(false_easting,false_northing);

return(OK);
}
Example #4
0
/* Initialize the Lambert Conformal conic projection
  ------------------------------------------------*/
int lamccforint(
double r_maj,                   /* major axis                           */
double r_min,                   /* minor axis                           */
double lat1,                    /* first standard parallel              */
double lat2,                    /* second standard parallel             */
double c_lon,                   /* center longitude                     */
double c_lat,                   /* center latitude                      */
double false_east,              /* x offset in meters                   */
double false_north)             /* y offset in meters                   */
{
double sin_po;                  /* sin value                            */
double cos_po;                  /* cos value                            */
double con;                     /* temporary variable                   */
double ms1;                     /* small m 1                            */
double ms2;                     /* small m 2                            */
double temp;                    /* temporary variable                   */
double ts0;                     /* small t 0                            */
double ts1;                     /* small t 1                            */
double ts2;                     /* small t 2                            */
r_major = r_maj;
r_minor = r_min;
false_northing = false_north;
false_easting = false_east;

/* Standard Parallels cannot be equal and on opposite sides of the equator
------------------------------------------------------------------------*/
if (fabs(lat1+lat2) < EPSLN)
   {
   p_error("Equal Latitiudes for St. Parallels on opposite sides of equator",
	   "lamcc-for");
   return(41);
   }
   
temp = r_minor / r_major;
es = 1.0 - SQUARE(temp);
e = sqrt(es);

center_lon = c_lon;
center_lat = c_lat;
tsincos(lat1,&sin_po,&cos_po);
con = sin_po;
ms1 = msfnz(e,sin_po,cos_po);
ts1 = tsfnz(e,lat1,sin_po);
tsincos(lat2,&sin_po,&cos_po);
ms2 = msfnz(e,sin_po,cos_po);
ts2 = tsfnz(e,lat2,sin_po);
sin_po = sin(center_lat);
ts0 = tsfnz(e,center_lat,sin_po);

if (fabs(lat1 - lat2) > EPSLN)
    ns = log (ms1/ms2)/ log (ts1/ts2);
else
    ns = con;
f0 = ms1 / (ns * pow(ts1,ns));
rh = r_major * f0 * pow(ts0,ns);


/* Report parameters to the user
  -----------------------------*/
ptitle("LAMBERT CONFORMAL CONIC");
radius2(r_major, r_minor);
stanparl(lat1,lat2);
cenlonmer(center_lon);
origin(c_lat);
offsetp(false_easting,false_northing);

return(OK);
}