Opened 12 years ago
Last modified 9 years ago
#1964 new defect
m.proj on wingrass: protect g.proj's path name to the grid file
Reported by: | hamish | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 6.4.6 |
Component: | Shell Scripts | Version: | svn-releasebranch64 |
Keywords: | wingrass, m.proj, cs2cs, g.proj | Cc: | |
CPU: | x86-32 | Platform: | MSWindows XP |
Description
Hi,
this has been a known thing for a while, but I think it deserves its own ticket. e.g. see #820's comment 28.
The m.proj shell script uses cs2cs to do the coord sys transform on the list of points. Unfortunately due to the way it parses its command line args, it's impossible to get cs2cs to work with quoting, so a +nadgrids= with spaces in the /path/to/grid/file side gets broken.
To add to this, msys helpfully decides to translate the string-which-looks-like-a-path and breaks it even further.
e.g. on wingrass 6.4.3svn make a new location, epsg 27200, for the datum transform option choose the grid file. (if the loc'n wizard is broken you may need to use g.setproj from the text startup with proj=nzmg datum=nzgd49)
that gets you this PROJ_INFO file:
name: New Zealand Map Grid proj: nzmg lat_0: -41 lon_0: 173 x_0: 2510000 y_0: 6023150 no_defs: defined datum: nzgd49 ellps: international nadgrids: nzgd2kgrid0005.gsb
and g.proj translates to these proj4 terms:
GRASS 6.4> g.proj -j +proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +no_defs +a=6378388 +rf=297 +nadgrids=c:/Program Files/GRASS GIS 6.4.3svn/etc/nad/nzgd2kgrid0005.gsb +to_meter=1
m.proj does this to that:
if [ $GIS_FLAG_I -eq 1 ] ; then OUT_PROJ=`g.proj -j | ( OUT_PROJ= while read line ; do OUT_PROJ="$OUT_PROJ '$line'" done echo "$OUT_PROJ" )` fi
msys sees a "/" and decides to act, e.g.:
GRASS 6.4> g.message "/" C:/PROGRA~1/GRASSG~1.3SV/msys
and the broken result of all this is:
GRASS 6.4> echo "167 -45" | m.proj -i input parameters=[+proj=longlat +datum=WGS84] output parameters=[+proj=nzmg +lat_0=-41 +lon_0=173 +x_0=2510000 +y_0=6023150 +no_defs +a=6378388 +rf=297 +nadgrids=c;C:\PROGRA~1\GRASSG~1.3SV\msys\Program Files\GRASS GIS 6.4.3svn\etc\nad\nzgd2kgrid0005.gsb +to_meter=1] Rel. 4.8.0, 6 March 2012 <cs2cs.exe>: Sys errno: 2: No such file or directory Files/GRASS Rel. 4.8.0, 6 March 2012 <cs2cs.exe>: Sys errno: 2: No such file or directory GIS Rel. 4.8.0, 6 March 2012 <cs2cs.exe>: Sys errno: 2: No such file or directory 6.4.3svn/etc/nad/nzgd2kgrid0005.gsb
perhaps the cygpath util could help?
or a couple of .bat file one-liners to make short 8.3 space-free path names on Windows:
for /d %I in (*) do @echo %~sI or for %I in (.) do echo %~sI
Hamish
if it helps, here's another little tool from $GISBASE/etc/init.sh:
Hamish