[Proj] quoting +nadgrids ?

Frank Warmerdam warmerdam at pobox.com
Sat Jul 31 08:22:05 EST 2010


Glynn Clements wrote:
> Frank Warmerdam wrote:
> 
>> My understanding is that this thread is really about weaknesses in the
>> DOS cmd.exe shell interpreter, right?
> 
> No.
> 
> The problem is that gdalwarp's -t_srs option expects a proj argument
> *list* as a single string, which it then splits into individual proj
> arguments using spaces as a seperator. That is problematic because
> some of those arguments may be filenames, which can contain spaces
> (particularly on Windows, where it's often impossible to create a file
> without spaces in its pathname unless you have Administrator
> privilege).

Glynn,

OK, I get the issue with the GDAL / PROJ.4 option.  I suppose I
am more concerned here (on the proj list) about the PROJ.4 library
and utilities itself.

> It may be possible to workaround this by using the 8.3 filename, i.e. 
> "c:\progra~1\..." instead of "C:\Program Files". However, that fails
> if the filename is being chosen via a GUI file selection dialog, which
> will only offer the full name for a directory. Also, it's possible to
> inhibit the creation of 8.3 filenames, and some security software
> flags use of 8.3 filenames as suspicious behaviour (it's a common
> tactic for bypassing filename-based access controls).
> 
> As far as actual solutions go:
> 
> One option is to provide a switch, e.g. -srs_sep, to allow a custom
> separator to be specified, e.g.:
> 
> gdalwarp -srs_sep "|" -t_srs "+proj=longlat|+datum=nad83|+nadgrids=c:\Program Files\GRASS\etc\nad\conus"

I would note that GDAL is going to throw away the +nadgrids
directive anyways.  GDAL converts things into WKT internally
and then later back to proj.4 format.  WKT does not support
declaration of grid shift files.

It is possible to add a +wkt_ext directive which tells GDAL
to embed the whole proj.4 definition literally in the WKT.
But when parsing the WKT the same issue with spaces in a
parameter will be encountered.

Based on this, I'm starting to think that the PROJ.4
parameter parser just ought to have a special escape
sequence for embedding a space.  Ideally something not
likely to "activate" other escape sequence parsers.
Something like:

+nadgrids=C:\Program@@@space@@@Files\GRASS...

If you would like me to incorporate such a change, let me know
via a proj.4 ticket and I'll proceed.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the Proj mailing list