aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2013-10-20 17:56:49 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2013-10-20 17:56:49 +0000
commit510f01ceb96f644e055b5439df46546a514592c4 (patch)
tree171ff9af5f702dcb788a0eaa956158b89c5a8442 /src
parentfb9b0c6b5de5eb937c74d3eab2ed376403cf1db9 (diff)
downloadPROJ-510f01ceb96f644e055b5439df46546a514592c4.tar.gz
PROJ-510f01ceb96f644e055b5439df46546a514592c4.zip
Support -I when no +to projection is provideD
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2388 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src')
-rw-r--r--src/cs2cs.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/cs2cs.c b/src/cs2cs.c
index 2fe7d8a9..357c4859 100644
--- a/src/cs2cs.c
+++ b/src/cs2cs.c
@@ -166,10 +166,9 @@ static void process(FILE *fid)
int main(int argc, char **argv)
{
- char *arg, **eargv = argv, *from_argv[MAX_PARGS], *to_argv[MAX_PARGS],
- **iargv = argv;
+ char *arg, **eargv = argv, *from_argv[MAX_PARGS], *to_argv[MAX_PARGS];
FILE *fid;
- int from_argc=0, to_argc=0, iargc = argc, eargc = 0, c, mon = 0;
+ int from_argc=0, to_argc=0, eargc = 0, c, mon = 0;
int have_to_flag = 0, inverse = 0, i;
if ((emess_dat.Prog_name = strrchr(*argv,DIR_CHAR)) != NULL)
@@ -340,7 +339,11 @@ int main(int argc, char **argv)
to_argc = argcount;
}
- if (!(fromProj = pj_init(from_argc, from_argv)))
+ if( from_argc == 0 && to_argc != 0 )
+ {
+ /* we will generate the from proj as the latlong of the +to in a bit */
+ }
+ else if (!(fromProj = pj_init(from_argc, from_argv)))
{
printf( "Using from definition: " );
for( i = 0; i < from_argc; i++ )
@@ -375,6 +378,20 @@ int main(int argc, char **argv)
pj_strerrno(pj_errno));
}
+ if( from_argc == 0 && toProj != NULL)
+ {
+ if (!(fromProj = pj_latlong_from_proj( toProj )))
+ {
+ printf( "Using to definition: " );
+ for( i = 0; i < to_argc; i++ )
+ printf( "%s ", to_argv[i] );
+ printf( "\n" );
+
+ emess(3,"projection initialization failure\ncause: %s",
+ pj_strerrno(pj_errno));
+ }
+ }
+
if (mon) {
printf( "%c ---- From Coordinate System ----\n", tag );
pj_pr_list(fromProj);