comp.lang.ada
 help / color / mirror / Atom feed
* Re: Earth map transformation in Ada ?
  2000-05-05  0:00 Earth map transformation in Ada ? Reinert Korsnes
  2000-05-05  0:00 ` Ted Dennison
@ 2000-05-05  0:00 ` tmoran
  2000-05-06  0:00   ` David C. Hoos, Sr.
  2000-05-07  0:00 ` Geoff Bull
  2000-05-09  0:00 ` Randy Pugh
  3 siblings, 1 reply; 7+ messages in thread
From: tmoran @ 2000-05-05  0:00 UTC (permalink / raw)


> lat,long  <-> x,y (Polar Stereographic)
Out of curiousity, what is that?  Some kind of geographic database?




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Earth map transformation in Ada ?
  2000-05-05  0:00 Earth map transformation in Ada ? Reinert Korsnes
@ 2000-05-05  0:00 ` Ted Dennison
  2000-05-05  0:00 ` tmoran
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Ted Dennison @ 2000-05-05  0:00 UTC (permalink / raw)


In article <8eudi9$ck7$1@news.uit.no>,
  Reinert.Korsnes@npolar.no wrote:
> Does someone know about available (Earth) map stransformations in Ada
?
> lat,long  <-> x,y (Polar Stereographic)

Its been done. Its just math. Take whatever algorithm you have laying
around to do it in Language X and translate it to Ada. It should be
quite trivial to do.


--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Earth map transformation in Ada ?
@ 2000-05-05  0:00 Reinert Korsnes
  2000-05-05  0:00 ` Ted Dennison
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Reinert Korsnes @ 2000-05-05  0:00 UTC (permalink / raw)


Does someone know about available (Earth) map stransformations in Ada ?

like:

lat,long  <-> x,y (Polar Stereographic)

reinert

-- 
Norwegian Polar Institute
Polar Environment Center
N-9296 Tromso
Norway
Fax: +47 77750501

http://geophys.npolar.no/~reinert/personal.html




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Earth map transformation in Ada ?
  2000-05-05  0:00 ` tmoran
@ 2000-05-06  0:00   ` David C. Hoos, Sr.
  0 siblings, 0 replies; 7+ messages in thread
From: David C. Hoos, Sr. @ 2000-05-06  0:00 UTC (permalink / raw)



<tmoran@bix.com> wrote in message
news:_NFQ4.29$375.13699@news.pacbell.net...
> > lat,long  <-> x,y (Polar Stereographic)
> Out of curiousity, what is that?  Some kind of geographic database?

A polar stereographic projection is a way to map the surface of a
spheroid onto a plane tangent to the spheroid surface at one of the poles.

For example, if the plane were tangent to the north pole, and the
projection point at the south pole, the meridians would be radials from
the tangent point on the plane, and parallels would be concentric
circles about the tangent point.
The size ratio of the projection at the north pole would be 1:1, at the
equator 2:1, and at the south pole, infinity.

Now, I said spheroid, because for many applications, modeling the earth
as a sphere is not good enough.  There are several spheroids in common
use -- e.g. the World Geodetic System 1984 (WGS-84) models the earth
as a polar section that is an ellipse having a polar radius of
6_356_752.3142 meters, and an equatorial radius of 6_378__137.0 meters,
at mean sea level.

The mathematics are straightforward, and the programming trivial, except
for dealing with singularities.  GNAT, for example, will return values
of NaN or +/- Inf. for some of these.  Testing for NaN, for example
requires a three-way test e.g., /=0 and then not < 0, and then not > 0.

There is a website
http://www.utexas.edu/depts/grg/gcraft/notes/datum/datum.html at which
conversion formulae may be found, to convert between various geographic
data forms.

This turned out to be more long-winded than I thought it would be when I
started to answer... oh, well.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Earth map transformation in Ada ?
  2000-05-05  0:00 Earth map transformation in Ada ? Reinert Korsnes
  2000-05-05  0:00 ` Ted Dennison
  2000-05-05  0:00 ` tmoran
@ 2000-05-07  0:00 ` Geoff Bull
  2000-05-07  0:00   ` Gary Scott
  2000-05-09  0:00 ` Randy Pugh
  3 siblings, 1 reply; 7+ messages in thread
From: Geoff Bull @ 2000-05-07  0:00 UTC (permalink / raw)




Reinert Korsnes wrote:
> 
> Does someone know about available (Earth) map stransformations in Ada ?
> 
> like:
> 
> lat,long  <-> x,y (Polar Stereographic)
> 
> reinert

I have a package for doing wgs84 calculations, which you may find useful
as a starting point. I can't remember wehther it produces 
correct answers. Here is an excerpt, I can mail you the whole
package if you like:

generic
   type Float_Type is digits <>;
package WGS84_Package is

     --  first  numerical eccentricity
      e1sqr : constant := (a ** 2 - b ** 2) / (a ** 2) ;

      --  second numerical eccentricity
      e2sqr : constant := (a ** 2 - b ** 2) / (b ** 2);

...
   subtype Metres is Float_Type;
   subtype Radians is Float_Type;
   subtype Degrees is Float_Type;

   type ECEF is -- earth centreed earth fixed rectangular coordinate
system
      record
         X : Metres;  --  though equator at prime meridian
         Y : Metres;  --  though equator 90 degrees east of prime
meridian
         Z : Metres;  --  through north pole
      end record;

 
   type Polar is
      record
         Latitude : Radians;
         Longitude : Radians;
         Altitude : Metres;
      end record;

   type Azimuth_Elevation is
      record
         Azimuth : Radians;
         Elevation : Radians;
         Distance : Metres;
      end record;

...

package body WGS84_Package is

    --  converts Latitude, Longitude and Altitude (above ellipsoid) to
XYZ
   function To_ECEF (From : in Polar) return ECEF is
      N : Float_Type := a / sqrt (1.0 - e1sqr * sin (From.Latitude) **
2);
   begin -- To_ECEF
      return
        (X => (N + From.Altitude) * cos (From.Latitude) * cos
(From.Longitude),

         Y => (N + From.Altitude) * cos (From.Latitude) * sin
(From.Longitude),

         Z => (N * (1.0 - e1sqr) + From.Altitude) * sin (From.Latitude)
         );
   end To_ECEF;


   --  converts XYZ to Latitude, Longitude, Altitude (above ellipsoid)
   function To_Polar (From : in ECEF) return Polar is
      -- length projected onto equatorial plane;
      P : Metres := sqrt (From.X ** 2 + From.Y ** 2);

      T : Float_Type := arctan ((From.Z * a) / (p * b));


      N : Float_Type;

      Latitude, Longitude : Radians;
      Altitude : Metres;
   begin -- To_Polar
      Latitude := arctan ((From.Z + e2sqr * b * Sin (T) ** 3)
                      / (P - e1sqr * a * Cos (T) ** 3));

      if From.X = 0.0 then
         Longitude := Pi / 2.0;
      else
         Longitude := arctan (From.Y / From.X);
      end if;

      N :=  A / Sqrt (1.0 - e1sqr * sin (Latitude) ** 2);
      Altitude := P / cos (Latitude) - N;

      return (Latitude, Longitude, Altitude);

   end To_Polar;


...




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Earth map transformation in Ada ?
  2000-05-07  0:00 ` Geoff Bull
@ 2000-05-07  0:00   ` Gary Scott
  0 siblings, 0 replies; 7+ messages in thread
From: Gary Scott @ 2000-05-07  0:00 UTC (permalink / raw)


If not too much trouble (or rude of me to ask), I would be overjoyed to
receive such a package.  I've been working on the same thing and have
searched high and low for one so that I didn't have to reinvent the
wheel.


Geoff Bull wrote:
> 
> Reinert Korsnes wrote:
> >
> > Does someone know about available (Earth) map stransformations in Ada ?
> >
> > like:
> >
> > lat,long  <-> x,y (Polar Stereographic)
> >
> > reinert
> 
> I have a package for doing wgs84 calculations, which you may find useful
> as a starting point. I can't remember wehther it produces
> correct answers. Here is an excerpt, I can mail you the whole
> package if you like:
> 
> generic
>    type Float_Type is digits <>;
> package WGS84_Package is
> 
>      --  first  numerical eccentricity
>       e1sqr : constant := (a ** 2 - b ** 2) / (a ** 2) ;
> 
>       --  second numerical eccentricity
>       e2sqr : constant := (a ** 2 - b ** 2) / (b ** 2);
> 
> ...
>    subtype Metres is Float_Type;
>    subtype Radians is Float_Type;
>    subtype Degrees is Float_Type;
> 
>    type ECEF is -- earth centreed earth fixed rectangular coordinate
> system
>       record
>          X : Metres;  --  though equator at prime meridian
>          Y : Metres;  --  though equator 90 degrees east of prime
> meridian
>          Z : Metres;  --  through north pole
>       end record;
> 
> 
>    type Polar is
>       record
>          Latitude : Radians;
>          Longitude : Radians;
>          Altitude : Metres;
>       end record;
> 
>    type Azimuth_Elevation is
>       record
>          Azimuth : Radians;
>          Elevation : Radians;
>          Distance : Metres;
>       end record;
> 
> ...
> 
> package body WGS84_Package is
> 
>     --  converts Latitude, Longitude and Altitude (above ellipsoid) to
> XYZ
>    function To_ECEF (From : in Polar) return ECEF is
>       N : Float_Type := a / sqrt (1.0 - e1sqr * sin (From.Latitude) **
> 2);
>    begin -- To_ECEF
>       return
>         (X => (N + From.Altitude) * cos (From.Latitude) * cos
> (From.Longitude),
> 
>          Y => (N + From.Altitude) * cos (From.Latitude) * sin
> (From.Longitude),
> 
>          Z => (N * (1.0 - e1sqr) + From.Altitude) * sin (From.Latitude)
>          );
>    end To_ECEF;
> 
>    --  converts XYZ to Latitude, Longitude, Altitude (above ellipsoid)
>    function To_Polar (From : in ECEF) return Polar is
>       -- length projected onto equatorial plane;
>       P : Metres := sqrt (From.X ** 2 + From.Y ** 2);
> 
>       T : Float_Type := arctan ((From.Z * a) / (p * b));
> 
>       N : Float_Type;
> 
>       Latitude, Longitude : Radians;
>       Altitude : Metres;
>    begin -- To_Polar
>       Latitude := arctan ((From.Z + e2sqr * b * Sin (T) ** 3)
>                       / (P - e1sqr * a * Cos (T) ** 3));
> 
>       if From.X = 0.0 then
>          Longitude := Pi / 2.0;
>       else
>          Longitude := arctan (From.Y / From.X);
>       end if;
> 
>       N :=  A / Sqrt (1.0 - e1sqr * sin (Latitude) ** 2);
>       Altitude := P / cos (Latitude) - N;
> 
>       return (Latitude, Longitude, Altitude);
> 
>    end To_Polar;
> 
> ...


-- 

Gary Scott
mailto:scottg@flash.net

mailto:webmaster@fortranlib.com
http://www.fortranlib.com

Support the GNU Fortran G95 Project:  http://xena.eas.asu.edu/~andy/




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Earth map transformation in Ada ?
  2000-05-05  0:00 Earth map transformation in Ada ? Reinert Korsnes
                   ` (2 preceding siblings ...)
  2000-05-07  0:00 ` Geoff Bull
@ 2000-05-09  0:00 ` Randy Pugh
  3 siblings, 0 replies; 7+ messages in thread
From: Randy Pugh @ 2000-05-09  0:00 UTC (permalink / raw)


I remember there being a program from the National Imagery and Mapping
Agency-NIMA (which USED to be the Defense Mapping Agency - DMA)...called
MADTRANS.  It would translate from UTM, Lat/Long, etc. in one datum to
anything you wanted in any datum.  I looked all over the NIMA and USGS sites
but couldn't find it.  It may be what you're looking for and I think they
made the source code available...   Hope this helps.
     Randy
Reinert Korsnes <reinert@ola.npolar.no> wrote in message
news:8eudi9$ck7$1@news.uit.no...
> Does someone know about available (Earth) map stransformations in Ada ?
>
> like:
>
> lat,long  <-> x,y (Polar Stereographic)
>
> reinert
>
> --
> Norwegian Polar Institute
> Polar Environment Center
> N-9296 Tromso
> Norway
> Fax: +47 77750501
>
> http://geophys.npolar.no/~reinert/personal.html






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-05-09  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-05  0:00 Earth map transformation in Ada ? Reinert Korsnes
2000-05-05  0:00 ` Ted Dennison
2000-05-05  0:00 ` tmoran
2000-05-06  0:00   ` David C. Hoos, Sr.
2000-05-07  0:00 ` Geoff Bull
2000-05-07  0:00   ` Gary Scott
2000-05-09  0:00 ` Randy Pugh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox