[Proj] Geo Transfoms and calculations

Eric Miller EMiller at dfg.ca.gov
Tue Dec 30 09:39:57 PST 2008


You need only a minor modification to Gerald's libproj4 to compile on
windows.  Because Microsoft is lame, their math library does not include
atanh (or asinh or acosh). 

Previously, I overcame this by building in a naive implementation of
atanh as:

double atanh( double x )
{
	return log((1 + x)/(1 - x))/2;
}

Since Gerald has since embraced the GSL, maybe we can get him to use
the GSL versions of those functions and let the GNU folks handle
platform compatibility.

>>> On 12/30/2008 at 7:40 AM, "Till" <till at free.fr> wrote:
> Thanks for your answers Gerald,
> 
> Is this library already available, or it is a brand new product that
can be
> only tested after being released? (Next week, obviously)
> 
> As far as I have understood, you're working on libproj4 project. Will
the
> 'geod_*' stuff be associated/related to it?
> By now, we only worked with proj.4, that means using proj.dll. This
is the
> only library we managed to compile with Visual C++. We failed with
libproj4,
> which looks as linux only.
> But we're quite happy with it, proj.dll fits properly our needs,
except
> we're missing those distance calculation functions.
> 
> What is your recommendation regarding this?
> How should the 'geod_*' set work in conjunction with it?
> 
> Thanks for your feedback.
> 
> -----Message d'origine-----
> De : Gerald I. Evenden [mailto:geraldi.evenden at gmail.com] 
> Envoyé : mardi 30 décembre 2008 01:55
> À : proj at lists.maptools.org 
> Cc : Till
> Objet : Re: [Proj] Geo Transfoms and calculations
> 
> Your timing could not be much better.
> 
> I have almost completed a library set 'geod_*' that covers geodesic 
> computations for both the spherical and elliptical earth.  I expect
to have
> a 
> first release out by this weekend as I am only doing finishing
touches on
> the 
> ellps= section (a user program version works right now with the
libproj4 
> library).  The ellipse method is based upon the NOAA routines rather
than
> the 
> USNOO process that I used in 'geod'---accuracy is also a little
better.
> 
> The release comes with Doxygen html documentation (~2mb), of all the
code
> and 
> a self documenting user program 'geodesic'---that is: you type
"geodesic"
> and 
> at the prompt "geod:" type "help."  Maybe a little more help on the
Doxygen 
> front page. ;-)
> 
> Also, see note imbedded below and geodesic example at end.
> 
> On Monday 29 December 2008 7:07:28 pm Till wrote:
>> Hi all,
>>
>> We're quite new to geographic fundamentals, but it sounds like
PROJ.4 is a
>> pretty good base where to find proper 'geographic related'
libraries.
>>
>> We're currently working on graphic (2D/3D) tools for displaying
accurate
>> GPS information and our goal is to rely on standard systems,
avoiding to
>> 'reinvent the wheel', feeling it should be much of a benefit if we
could
>> share with the community.
>>
>> By now, we were able to properly use the 'proj' API in order to
match
>> different projection schemes into 'Cartesian' (3D space)
coordinates, and
>> also mix 2D representations.
>>
>> However, distance calculation seems to be another issue.
>>
>> While we could find ways to implement a reasonable calculation
>>
>> (for instance :
>>
>> gpsDist(PointF P1, PointF P2)
>>
>> {
>>
> This is a common equation for spherical geodesic but it is not very
good for
> 
> small values of the argument because acos looses precision.  All
geodesic 
> code I have used employs Snyder's recommended variation as in the
geod_* 
> library.
> 
>> return Acos( sin(P1.y)*sin(P2.y) +
cos(P1.y)*cos(P2.y)*cos(P1.x-P2.x) ) *
>> earthRadius;
>>
>> }),
>>
>> our approach considers it could be concentrated on the same system,
in
>> order to provide consistency (at least sharing 'earthRadius'
values).
>>
>> In that manner, we failed to use 'geod' or affiliate as API.
>>
>> We have to say that we're developing on Windows platform (VS 2005),
and
>> we're lacking sample/tutorial/help for such a use.
>>
>> Any help in that manner would be welcome.
>>
>>
>>
>> PS: Is there a proper (recommended) way to increase 'ellipsoid'
> definitions
>> (increasing or modifying  'pj_ellps' table, for instance changing
>> "sphere"'s radius)?
> 
> Note that both traditional proj DMS and GRASS colon format geographic

> coordinates are read.
> 
> gie at charon:~/CARTO/geodesic/src$ ./geodesic
> geod: help
> command: earth -- set earth shape parameters
> command: show -- display [arc|earth] structure contents
> command: p1 -- set point 1 [lon lat]
> command: p2 -- set point 2 [lon lat]
> command: open -- open output file
> command: vector -- set vector [distance azimuth
> command: line -- compute geodesic line
> command: circle -- compute circle or arc [2nd azi. del azi.]
> command: prec -- set display precision
> command: quit -- exit program
> command: help -- show this list
> 
> For more detailed assistance type "<command> help" for
> more detailed information on that command.
> geod: earth ellps=WGS84
> geod: p1 100d14'33.2W 30d15
> geod: p2 -90:17:55 44d7'30n
>     Point 1 Lon:  100d14'33.20000"W  Lat:   30d15'00.00000"N  height:
0.000
>     Point 2 Lon:   90d17'55.00000"W  Lat:   44d07'30.00000"N  height:
0.000
>     Azimuth p1->p2: 26d55'6.60"
>     Distance: 1771916.625
>     Azimuth p2->p1: 212d58'58.59"
> geod: quit
> geodesic at completion.   G'day mate!
> gie at charon:~/CARTO/geodesic/src$



More information about the Proj mailing list