32
31
int main(int argc, char **argv)
34
33
struct GModule *module;
35
struct Flag *once, *decimal, *latlong, *wgs84, *dcoord;
34
struct Option *coords, *file;
35
struct Flag *decimal, *latlong, *wgs84, *dcoord;
36
36
int have_spheroid = 0;
38
39
/* Initialize the GIS calls */
39
40
G_gisinit(argv[0]);
41
42
module = G_define_module();
42
module->keywords = _("display, position, querying");
43
G_add_keyword(_("display"));
44
G_add_keyword(_("sampling"));
45
G_add_keyword(_("position"));
46
G_add_keyword(_("querying"));
43
47
module->description =
44
48
_("Identifies the geographic coordinates associated with "
45
"point locations in the active frame on the graphics monitor.");
47
once = G_define_flag();
49
once->description = _("One mouse click only");
49
"point locations given in display coordinates.");
51
coords = G_define_option();
53
coords->key_desc = "x,y";
54
coords->type = TYPE_DOUBLE;
55
coords->required = NO;
56
coords->multiple = YES;
58
_("Display coordinates to convert");
60
file = G_define_standard_option(G_OPT_F_INPUT);
63
_("File from which to read coordinates (\"-\" to read from stdin)");
51
65
decimal = G_define_flag();
52
66
decimal->key = 'd';
72
86
/* if (G_parser(argc,argv)) */
73
if (argc > 1 && G_parser(argc, argv))
87
if (G_parser(argc, argv))
74
88
exit(EXIT_FAILURE);
76
90
if (latlong->answer && wgs84->answer)
143
if (R_open_driver() != 0)
144
G_fatal_error(_("No graphics device selected"));
158
if (strcmp(file->answer, "-") == 0)
161
fp = fopen(file->answer, "r");
163
G_fatal_error(_("Unable to open input file <%s>"), file->answer);
146
where_am_i(once->answer, have_spheroid, decimal->answer, wgs84->answer,
173
where_am_i(coords->answers, fp, have_spheroid, decimal->answer, dcoord->answer);
150
177
exit(EXIT_SUCCESS);