aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2001-04-05 04:22:39 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2001-04-05 04:22:39 +0000
commite6bcf568fa75e326da450f2ead8fdc152252b1e0 (patch)
treec2056a2adc2924c8b4ba0e1e4d7589b355cea307 /src
parent6ecf8d383a2000b6820dd77a8c0166cabe497879 (diff)
downloadPROJ-e6bcf568fa75e326da450f2ead8fdc152252b1e0.tar.gz
PROJ-e6bcf568fa75e326da450f2ead8fdc152252b1e0.zip
added pj_init_plus()
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@926 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src')
-rw-r--r--src/pj_init.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/pj_init.c b/src/pj_init.c
index 993d2ff9..6ec87bf4 100644
--- a/src/pj_init.c
+++ b/src/pj_init.c
@@ -73,6 +73,63 @@ get_init(paralist *next, char *name) {
}
/************************************************************************/
+/* pj_init_plus() */
+/* */
+/* Same as pj_init() except it takes one argument string with */
+/* individual arguments preceeded by '+', such as "+proj=utm */
+/* +zone=11 +ellps=WGS84". */
+/************************************************************************/
+
+PJ *
+pj_init_plus( const char *definition )
+
+{
+#define MAX_ARG 200
+ char *argv[MAX_ARG];
+ char *defn_copy;
+ int argc = 0, i;
+ PJ *result;
+
+ /* make a copy that we can manipulate */
+ defn_copy = pj_malloc( strlen(definition)+1 );
+ strcpy( defn_copy, definition );
+
+ /* split into arguments based on '+' and trim white space */
+
+ for( i = 0; defn_copy[i] != '\0'; i++ )
+ {
+ switch( defn_copy[i] )
+ {
+ case '+':
+ if( argc+1 == MAX_ARG )
+ {
+ pj_errno = -44;
+ return NULL;
+ }
+
+ argv[argc++] = defn_copy + i + 1;
+ break;
+
+ case ' ':
+ case '\t':
+ case '\n':
+ defn_copy[i] = '\0';
+ break;
+
+ default:
+ /* do nothing */
+ }
+ }
+
+ /* perform actual initialization */
+ result = pj_init( argc, argv );
+
+ pj_dalloc( defn_copy );
+
+ return result;
+}
+
+/************************************************************************/
/* pj_init() */
/* */
/* Main entry point for initialing a PJ projections */