[Proj] quoting +nadgrids ?
hamish_b at yahoo.com
Thu Aug 26 05:17:46 EST 2010
> > """
> > So when this string is passed as a CRS to cs2cs it only
> > reads as far as the "C:\Program" part for the grid file and
> > all goes downhill fast from there.
> > """
> cs2cs was fixed with Glynn's suggestion:
> IN_PROJ=`g.proj -j`
> IN_PROJ=`g.proj -j | (
> while read line ; do
> IN_PROJ="$IN_PROJ '$line'"
> echo "$IN_PROJ"
> after applying that, and audit showed that is was also a problem for
> gdalwarp, but in that case there was no work around as it only takes
> a single (quoted) argument for the entire +proj string, with no way
> to quote individual terms within it. cs2cs takes a series of arguments
> each of which can be individually quoted.
hmph, actually this one is not fixed, and I'm afraid the shell
scripting magic to fix it has me stumped.
copy the NTv2 file somewhere with a space in it:
mkdir "/tmp/nad test"
cp "$GISBASE"/etc/nad/nzgd2kgrid0005.gsb "/tmp/nad test/"
IN_PROJ="'+proj=nzmg' '+lat_0=-41' '+lon_0=173' '+x_0=2510000' '+y_0=6023150' '+no_defs' '+a=6378388' '+rf=297' '+nadgrids=/tmp/nad test/etc/nad/nzgd2kgrid0005.gsb' '+to_meter=1'"
then feed a point to cs2cs using those shell variables:
echo "2006797 5490896" | cs2cs -w5 $IN_PROJ +to $OUT_PROJ
Using from definition:
Rel. 4.6.0, 21 Dec 2007
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated
same exact thing, but with expanded variables, and it works ?!:
echo "2006797 5490896" | cs2cs -w5 '+proj=nzmg' '+lat_0=-41' '+lon_0=173' \
'+x_0=2510000' '+y_0=6023150' '+no_defs' '+a=6378388' '+rf=297' \
'+nadgrids=/tmp/nad test/nzgd2kgrid0005.gsb' '+to_meter=1' \
+to +proj=longlat +datum=WGS84
166d32'36.78939"E 45d36'42.47115"S 0.000
I've tried a number of permutations of eval, `echo $IN_PROJ`, and
different flavours of quoting styles, but I just can't seem to
get the literal expansion to work.
More information about the Proj