You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we experience problems with cs2cs and gdalwarp when using +proj terms to define the CRSs when the full path to the grid file is used with +nadgrids=, and path contains spaces (e.g. C:\Program Files).
It would be nice if when pj_get_def() is building the definition string it could strncmp() for '+nadgrids=', strstr() to look for spaces (etc.) in the param, and if some were found put "quotes" around the part of the string to the right of the '='. If no spaces or other special chars, then no quotes. It might happen earlier when the param string is constructed, but it seems the sort of thing which perhaps shouldn't happen until the very last moment before fprintf(stdout,) since the string isn't always destined for use in a command.
my current approach is to use some ugly regex to try and make the pj_get_def() output string usable as CRS input for cs2cs or gdalwarp on the command line, but it's brittle and less than ideal.
thoughts?
thanks,
Hamish
ps- 4.7.0 as there's no "Version" option for 4.8.0 in trac
Comment by hamish on 7 Jul 2013 14:27 UTC
Also, it would be helpful if cs2cs did some more checks for when the given grid file name is bad, exiting with an error instead of silently falling back to the null-gridfile answer:
Comment by warmerdam on 21 Oct 2013 04:03 UTC
Hamish,
I just tried:
echo "170 -45" | cs2cs +proj=longlat +datum=WGS84 +to \
? +proj=nzmg +datum=nzgd49 +nadgrids=\"nzgd2kgrid0005.gsb\"
Rel. 4.9.0, 22 June 2013
<cs2cs>: while processing file: <stdin>, line 1
pj_transform(): failed to load datum shift file
* * 0.00
This is the behavior I expect. If the nadgrid filename isn't prefixed with "@" then not finding it when needed should be an error.
With regard to pj_get_def() quoting strings with spaces, I spent a bunch of time working on this but came - more or less - to the conclusion that it isn't a good idea. The current definition is suitable for us with pj_init_plus() even without quoting.
It feels wrong for me to try and quote it for the unix command shell (other shells might have other rules). And if I did, then I have to change the parser so that it can ignore quotes. This seems dangerous, in part because quotes really mean something in some contexts.
I was disappointed to discover that cs2cs cannot take a whole definition of a coordinate system as one quoted string and pass it to pj_init_plus() currently, otherwise on unix you could just put single quotes around the whole thing to pass it to cs2cs.
For now I'm not prepared to change pj_get_def() to quote things even though I realize it makes it hard to use on the commandline (in some circumstances).
Reported by hamish on 3 Jul 2013 23:58 UTC
Hi,
we experience problems with cs2cs and gdalwarp when using +proj terms to define the CRSs when the full path to the grid file is used with +nadgrids=, and path contains spaces (e.g. C:\Program Files).
It would be nice if when pj_get_def() is building the definition string it could strncmp() for '+nadgrids=', strstr() to look for spaces (etc.) in the param, and if some were found put "quotes" around the part of the string to the right of the '='. If no spaces or other special chars, then no quotes. It might happen earlier when the param string is constructed, but it seems the sort of thing which perhaps shouldn't happen until the very last moment before fprintf(stdout,) since the string isn't always destined for use in a command.
my current approach is to use some ugly regex to try and make the pj_get_def() output string usable as CRS input for cs2cs or gdalwarp on the command line, but it's brittle and less than ideal.
thoughts?
thanks,
Hamish
ps- 4.7.0 as there's no "Version" option for 4.8.0 in trac
Migrated-From: https://trac.osgeo.org/proj/ticket/218
The text was updated successfully, but these errors were encountered: