aboutsummaryrefslogtreecommitdiff
path: root/src/proj.c
diff options
context:
space:
mode:
authorSøren Holm <sgh@sgh.dk>2018-09-05 22:17:10 +0200
committerKristian Evers <kristianevers@gmail.com>2018-09-05 22:17:10 +0200
commitc11b98b058d883df6a0ef0a052ffd7565b00f921 (patch)
treef15a8c57306ab2a5bb7db062b6a793e0ed66b751 /src/proj.c
parent76488c5133207045f4bf9ccd3a9b4d0daf2372f5 (diff)
downloadPROJ-c11b98b058d883df6a0ef0a052ffd7565b00f921.tar.gz
PROJ-c11b98b058d883df6a0ef0a052ffd7565b00f921.zip
Add -d option to proj, cs2cs and cct (#1109)
Specify number of decimals to display when transforming coordinates with either proj, cs2cs or cct.
Diffstat (limited to 'src/proj.c')
-rw-r--r--src/proj.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/proj.c b/src/proj.c
index acd34da6..6fe579ee 100644
--- a/src/proj.c
+++ b/src/proj.c
@@ -45,11 +45,12 @@ static int
static char
*cheby_str, /* string controlling Chebychev evaluation */
- *oform = (char *)0; /* output format for x-y or decimal degrees */
+ *oform = (char *)0, /* output format for x-y or decimal degrees */
+ oform_buffer[16]; /* Buffer for oform when using -d */
static const char
*oterr = "*\t*", /* output line for unprojectable input */
- *usage = "%s\nusage: %s [ -beEfiIlmorsStTvVwW [args] ] [ +opts[=arg] ] [ files ]\n";
+ *usage = "%s\nusage: %s [ -bdeEfiIlmorsStTvVwW [args] ] [ +opts[=arg] ] [ files ]\n";
static struct FACTORS facs;
@@ -452,6 +453,11 @@ int main(int argc, char **argv) {
if (--argc <= 0) goto noargument;
oform = *++argv;
continue;
+ case 'd':
+ if (--argc <= 0) goto noargument;
+ sprintf(oform_buffer, "%%.%df", atoi(*++argv));
+ oform = oform_buffer;
+ break;
case 'r': /* reverse input */
reversein = 1;
continue;