source: SH_SHM/branches/2011.2/source/motif/GeographicRegion.c @ 293

Revision 293, 1001 bytes checked in by marcus, 8 years ago (diff)

r142 | klaus | 2010-10-29 16:55:30 +0200 (Fr, 29 Okt 2010) | 1 line

standalone program to determine geographic region

Line 
1
2/* file GeographicRegion.c
3 *      ==================
4 *
5 * version 1, 28-Oct-2010
6 *
7 * Retrieve name of geographic region from lat and lon.
8 * K. Stammler, 28-Oct-2010
9 */
10
11
12#include <stdio.h>
13#include <string.h>
14
15void get_geo(float *elat, float *elon, int *num_id, char *qnam);
16
17int main( int argc, char *argv[] )
18{
19    /* local variables */
20    float    lat, lon;     /* epicentre location */
21    int      regid;        /* region ID */
22    char     regname[300]; /* region name */
23
24    /* executable code */
25
26    if  (argc < 3)  {
27        fprintf( stderr, "Usage: %s <lat> <lon>\n", argv[0] );
28        return 0;
29    } /*endif*/
30
31    if  (sscanf( argv[1], "%f", &lat ) != 1)  {
32        fprintf( stderr, "cannot read lat\n" );
33        return 1;
34    } /*endif*/
35    if  (sscanf( argv[2], "%f", &lon ) != 1)  {
36        fprintf( stderr, "cannot read lon\n" );
37        return 1;
38    } /*endif*/
39
40    get_geo( &lat, &lon, &regid, regname );
41    printf( "%d %s\n", regid, regname );
42
43} /* end of main */
Note: See TracBrowser for help on using the repository browser.