summaryrefslogtreecommitdiff
path: root/test_geoid.c
blob: 5db55019d1f0c73b2beede2a9b13c0efc1f6820e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* $Id$ */
/* 
 * test driver for the ECEF to WGS84 conversions in geoid.c
 *
 */

#include <sys/types.h>
#include <math.h>
#include "gpsd_config.h"
#include "gpsd.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    double	lat, lon;

    if (argc != 3) {
	fprintf(stderr,"Usage: %s lat lon\n",argv[0]);
	return 1;
    }

    lat=atof(argv[1]);
    lon=atof(argv[2]);

    if (lat > 90. || lat < -90.)
    {
	fprintf(stderr," -90 <= lat=%s(%.f) <= 90 ?\n",argv[1],lat);
	return 1;
    }

    if (lon > 180. || lat < -180.)
    {
	fprintf(stderr," -180 <= lon=%s(%.f) <= 180 ?\n",argv[2],lon);
	return 1;
    }

    printf(" lat= %f lon= %f geoid correction= %f\n",
	   lat, lon, wgs84_separation(lat, lon));

    return 0;
}