[Proj] Additional up coming mods to libproj4
Gerald I. Evenden
geraldi.evenden at gmail.com
Sun Oct 19 10:47:09 EDT 2008
Besides the inverse material for some projections I took a couple of minutes
to add the proj_initstr(chr *) entry to the library as an alternative to
proj_init(int, char **); In addition, each string field of the later entry
may have multiple white-space separated projection options in the string.
The net result of this is that one can use lproj in the following manner:
lproj "+proj=poly ellps=intl lon_0=90w" +lat_0=40 infile
where the ellps= and lon_0= options are processed properly along with proj=
and lat_0=. Remember that the "+" part of the options is only necessary for
[l]proj to identify the runline parameter as a libproj option and not a
filename.
For those who use the library directly:
P=proj_initstr("proj=poly ellps=intl lon_0=90w lat_0=40");
may be used as an alternative to proj_init and is processed the same as the
lproj example.
I believe that Warmerdam has done something similar with his value added
releases.
The change is simple as the rcsdiff listing of proj_init.c shows: (note: there
is the prototype
PROJ *proj_initstr(char *);
added to lib_proj.h)
7c7
< LIBPROJ_ID[] = "$Id: proj_init.c,v 3.1 2006/01/11 01:38:18 gie Exp $";
---
> LIBPROJ_ID[] = "$Id: proj_init.c,v 3.2 2008/10/19 02:33:51 gie Exp $";
37c37
< proj_init(int argc, char **argv) {
---
> proj_init(int argc, char *argv[]) {
41c41
< int i;
---
> int i, first = 1;
47,51c47,55
< for (i = 0; i < argc; ++i)
< if (i)
< curr = curr->next = proj_mkparam(argv[i]);
< else
< start = curr = proj_mkparam(argv[i]);
---
> for (i = 0; i < argc; ++i) {
> char *ss;
> for (ss = argv[i]; (ss = strtok(ss, " \t")) != NULL; ss = NULL)
> if (first) {
> start = curr = proj_mkparam(ss);
> first = 0;
> } else
> curr = curr->next = proj_mkparam(ss);
> }
134a139,144
> PROJ *
> proj_initstr(char *str) {
> char * plist[1];
> plist[0] = str;
> return(proj_init(1, plist));
> }
136a147,151
> ** Revision 3.2 2008/10/19 02:33:51 gie
> ** added proj_initstr(char *str) entry as well as allowing
> ** multiple control entries per argv[] elements.
> ** Thus "proj=xxx ellps=xxx lon_0=xxx" are allowed.
> **
--
The whole religious complexion of the modern world is due
to the absence from Jerusalem of a lunatic asylum.
-- Havelock Ellis (1859-1939) British psychologist
More information about the Proj
mailing list