Opened 14 years ago

Closed 12 years ago

#1189 closed defect (fixed)

wingrass: 'g.region -l' fails when using a NTv2 grid file

Reported by: hamish Owned by: grass-dev@…
Priority: critical Milestone: 6.4.2
Component: Packaging Version: svn-develbranch6
Keywords: wingrass, g.region, NTv2 Cc:
CPU: x86-32 Platform: MSWindows XP

Description

Hi,

on a new wingrass 6.5svn nightly build, in the spearfish dataset, 'g.region -l' fails with an error.

ERROR: Unable to update lat/long projection parameters

running again with export PROJ_DEBUG=5 on the msys rxvt terminal line shows:

pj_open_lib(proj_def.dat):
   call fopen(c:/Program Files/GRASS-65-SVN/etc/nad/proj_def.dat) - failed

(in the wingrass builds that file is in $GISBASE/proj/)

$PROJ_LIB is already set by the startup script:

GRASS 6.5> echo $PROJ_LIB 
C:\Program Files\GRASS-65-SVN\proj

?

thanks, Hamish

Change History (16)

comment:1 by neteler, 14 years ago

I had reported this to PROJ as http://trac.osgeo.org/proj/ticket/81

FrankW has identified the problem (which only occurred for him when proj_def.dat could not be found) and fixed it (http://trac.osgeo.org/proj/changeset/1914). All this happened only in proj-trunk.

I can confirm that this problem has been solved for at least Linux but I assume that the solution is general.

Markus

comment:2 by hamish, 14 years ago

Right. as seen in #1166, this is 4.7.1svn:

Rel. 4.7.1, 23 September 2009

so am I right in thinking that osgeow4 is shipping development versions instead of stable releases? bad osgeo4w. no cupcake for you.

Hamish

comment:3 by hamish, 14 years ago

Roger B. wrote:

No, see:

http://lists.maptools.org/pipermail/proj/2009-September/004912.html

4.7.0 shipped with the wrong version number hardcoded.

Promise of cupcake restored? I don't know whether the suggestion by Markus
at the end of that thread got implemented?

Roger

so I'm back to being confused by this. Note in #1166 proj_def.dat is correctly found by cs2cs, although $PROJ_LIB there is probably being used by the cs2cs app not the lib (the lib already knows where it is and to set that would be recursive).

Hamish

in reply to:  3 ; comment:4 by hellik, 14 years ago

Replying to hamish:

Roger B. wrote:

No, see:

http://lists.maptools.org/pipermail/proj/2009-September/004912.html

4.7.0 shipped with the wrong version number hardcoded.

Promise of cupcake restored? I don't know whether the suggestion by Markus
at the end of that thread got implemented?

Roger

so I'm back to being confused by this. Note in #1166 proj_def.dat is correctly found by cs2cs, although $PROJ_LIB there is probably being used by the cs2cs app not the lib (the lib already knows where it is and to set that would be recursive).

Hamish

I've tried in a self built WinGrass6.4.1RC1-installer with the nc-dataset:

g.region -l                                                                     
north-west corner: long: 78:46:27.411935W lat: 35:48:34.91826N
north-east corner: long: 78:36:29.889864W lat: 35:48:33.404669N
south-east corner: long: 78:36:32.013293W lat: 35:41:14.377291N
south-west corner: long: 78:46:28.635587W lat: 35:41:15.888661N
center longitude:  78:41:29.48767W
center latitude:   35:44:54.64722N
rows:              451
cols:              500

Helmut

comment:5 by hellik, 14 years ago

Keywords: wingrass added

in reply to:  4 comment:6 by hellik, 14 years ago

Replying to hellik:

I've tried in a self built WinGrass6.4.1RC1-installer with the nc-dataset:

g.region -l                                                                     
north-west corner: long: 78:46:27.411935W lat: 35:48:34.91826N
north-east corner: long: 78:36:29.889864W lat: 35:48:33.404669N
south-east corner: long: 78:36:32.013293W lat: 35:41:14.377291N
south-west corner: long: 78:46:28.635587W lat: 35:41:15.888661N
center longitude:  78:41:29.48767W
center latitude:   35:44:54.64722N
rows:              451
cols:              500

Helmut

very strange:

(1) tried with WinGRASS-6.4.SVN-r45671-1-Setup.exe in nc-sample-data-set. it's working.

(2) tried with WinGRASS-6.4.SVN-r45671-1-Setup.exe in spearfish-sample dataset:

GRASS 6.4> g.region -l
WARNUNG: pj_transform() fehlgeschlagen: failed to load datum shift file
FEHLER: Fehler in pj_do_proj (Projektion des Eingabekoordinatenpaars).

maybe there's something wrong with the sample dataset?

because also tested with a ETRS_1989_LAEA- and a Transverse Mercator (hermannskogel)-location. g.region -l is working.

Helmut

Helmut

comment:7 by hamish, 14 years ago

[spearfish]

WARNUNG: pj_transform() fehlgeschlagen: failed to load datum shift file

ok, so perhaps a spaces in pathnames problem. look for the +nadgrids= filename from 'g.proj -p'.

maybe there's something wrong with the sample dataset?

seeing that spearfish is the most-tested dataset out there, if there was a problem there I think we would have found it by now.

another thing to try: 'g.region -d' before 'g.region -l'.

Hamish

in reply to:  7 ; comment:8 by hellik, 14 years ago

Replying to hamish:

[spearfish]

WARNUNG: pj_transform() fehlgeschlagen: failed to load datum shift file

maybe there's something wrong with the sample dataset?

seeing that spearfish is the most-tested dataset out there, if there was a problem there I think we would have found it by now.

another thing to try: 'g.region -d' before 'g.region -l'.

tested by wingrass64, wingrass65, wingrass70

-WinGRASS-6.4.SVN-r45671-1-Setup.exe

GRASS 6.4> g.proj -p
-PROJ_INFO-------------------------------------------------
name       : UTM
datum      : nad27
nadgrids   : conus
proj       : utm
ellps      : clark66
a          : 6378206.4000000004
es         : 0.0067686580
f          : 294.9786982000
zone       : 13
-PROJ_UNITS------------------------------------------------
unit       : meter
units      : meters
meters     : 1.0
GRASS 6.4> g.region -d
GRASS 6.4> g.region -l
WARNUNG: pj_transform() fehlgeschlagen: failed to load datum shift file
FEHLER: Fehler in pj_do_proj (Projektion des Eingabekoordinatenpaars).

-WinGRASS-6.5.SVN-r45672-1-Setup.exe

GRASS 6.5> g.proj -p
-PROJ_INFO-------------------------------------------------
name       : UTM
datum      : nad27
nadgrids   : conus
proj       : utm
ellps      : clark66
a          : 6378206.4000000004
es         : 0.0067686580
f          : 294.9786982000
zone       : 13
-PROJ_UNITS------------------------------------------------
unit       : meter
units      : meters
meters     : 1.0
GRASS 6.5> g.region -d
GRASS 6.5> g.region -l
WARNUNG: pj_transform() fehlgeschlagen: failed to load datum shift file
FEHLER: Fehler in pj_do_proj (Projektion des Eingabekoordinatenpaars).
GRASS 6.5> 

-WinGRASS-7.0.SVN-r45681-1-Setup.exe

GRASS 7.0.svn> g.proj -p
-PROJ_INFO-------------------------------------------------
name       : UTM
datum      : nad27
nadgrids   : conus
proj       : utm
ellps      : clark66
a          : 6378206.4000000004
es         : 0.0067686580
f          : 294.9786982000
zone       : 13
-PROJ_UNITS------------------------------------------------
unit       : meter
units      : meters
meters     : 1.0
GRASS 7.0.svn>
GRASS 7.0.svn> g.region -d
GRASS 7.0.svn> g.region -l
WARNUNG: pj_transform() fehlgeschlagen: failed to load datum shift file
FEHLER: Fehler in pj_do_proj (Projektion des Eingabekoordinatenpaars).
GRASS 7.0.svn>

ok, so perhaps a spaces in pathnames problem. look for the +nadgrids= filename from 'g.proj -p'.

any other test out there to test if there is maybe another spaces-in-pathnames-problem?

Helmut

in reply to:  8 comment:9 by hellik, 14 years ago

Replying to hellik:

any other test out there to test if there is maybe another spaces-in-pathnames-problem?

some additional information

GRASS 6.4> g.proj -d
GRASS datum code: nad27
WKT Name: North_American_Datum_1927
Datum transformation parameters (PROJ.4 format):
        nadgrids=c:/Program Files/GRASS 6.4.SVN/etc/nad/conus
GRASS 6.4> g.proj -j
+proj=utm
+zone=13
+a=6378206.4
+rf=294.9786982
+no_defs
+nadgrids=c:/Program Files/GRASS 6.4.SVN/etc/nad/conus
+to_meter=1.0
GRASS 6.4> 
GRASS 6.5> g.proj -d
GRASS datum code: nad27
WKT Name: North_American_Datum_1927
Datum transformation parameters (PROJ.4 format):
        nadgrids=c:/Program Files/GRASS 6.5.SVN/etc/nad/conus
GRASS 6.5> g.proj -j
+proj=utm
+zone=13
+a=6378206.4
+rf=294.9786982
+no_defs
+nadgrids=c:/Program Files/GRASS 6.5.SVN/etc/nad/conus
+to_meter=1.0
GRASS 7.0.svn> g.proj -j
+proj=utm
+zone=13
+a=6378206.4
+rf=294.9786982
+no_defs
+nadgrids=C:\Program Files\GRASS 7.0.SVN/etc/nad/conus
+to_meter=1.0
GRASS 7.0.svn>
GRASS 7.0.svn> g.proj -d
GRASS datum code: nad27
WKT Name: North_American_Datum_1927
Datum transformation parameters (PROJ.4 format):
        nadgrids=C:\Program Files\GRASS 7.0.SVN/etc/nad/conus
GRASS 7.0.svn>

comment:10 by hamish, 14 years ago

oh, something else I just remembered-- does the grid file actually exist on the hard drive?

ISTR that part of the big osgeo4w patch last month included a line where, for reasons unknown to me, it commented out the line where the grid files got installed.

could you check if they are still in c:/Program Files/GRASS 6.*/etc/nad/?

Hamish

in reply to:  10 comment:11 by hellik, 14 years ago

Replying to hamish:

oh, something else I just remembered-- does the grid file actually exist on the hard drive?

ISTR that part of the big osgeo4w patch last month included a line where, for reasons unknown to me, it commented out the line where the grid files got installed.

could you check if they are still in c:/Program Files/GRASS 6.*/etc/nad/?

WinGRASS-6.4.SVN-r45671-1-Setup.exe

 Volume in Laufwerk C: hat keine Bezeichnung.
 Volumeseriennummer: 4573-B06D

 Verzeichnis von C:\Program Files\GRASS 6.4.SVN\etc\nad

17.03.2011  23:05    <DIR>          .
17.03.2011  23:05    <DIR>          ..
17.03.2011  03:06         1.053.896 alaska
17.03.2011  03:06           264.392 conus
17.03.2011  03:06             8.840 FL
17.03.2011  03:06           451.976 hawaii
17.03.2011  03:06             3.528 MD
17.03.2011  03:06         1.113.184 ntv1_can.dat
17.03.2011  03:06           318.464 nzgd2kgrid0005.gsb
17.03.2011  03:06            26.696 prvi
17.03.2011  03:06            59.176 stgeorge
17.03.2011  03:06            26.696 stlrnc
17.03.2011  03:06             7.016 stpaul
17.03.2011  03:06             4.392 TN
17.03.2011  03:06             6.728 WI
17.03.2011  03:06            11.080 WO
              14 Datei(en),      3.356.064 Bytes
               2 Verzeichnis(se), 37.652.611.072 Bytes frei

Helmut

comment:12 by hamish, 13 years ago

Keywords: NTv2 added
Milestone: 6.4.16.4.2
Summary: wingrass: 'g.region -l' failswingrass: 'g.region -l' fails when using a NTv2 grid file
  • bug still present in wingrass native 6.4.svn r48373 (Sept 2011) + spearfish.
  • $PROJ_LIB/conus file exists.
  • assume you'll get the same error with any projection which uses a NTv2 grid file.
  • the missing $GISBASE/etc/nad/proj_def.dat file is in $PROJ_LIB.
  • copying proj_def.dat into $GISBASE/etc/nad/ gets a bit further, but still breaks with an unquoted pathname error. (see next post)

Hamish

comment:13 by hamish, 13 years ago

running with export PROJ_DEBUG=5 on the msys rxvt terminal line with proj_def.dat copied into $GISBASE/etc/nad/ now shows:

GRASS 6.4> g.region.exe -l
WARNING: pj_transform() failed: failed to load datum shift file
ERROR: Error in pj_do_proj (projection of input coordinate pair)
pj_open_lib(proj_def.dat): call fopen(c:/Program Files/GRASS 6.4.SVN/etc/nad/proj_def.dat) - succeeded

pj_open_lib(c:/Program Files/GRASS 6.4.SVN/etc/nad/conus): call fopen(c:/Program Files/GRASS 6.4.SVN/etc/nad/conus) - succeeded

Ctable Conterminous United States 273x121: LL=(-131,20) UR=(-63,50)

pj_open_lib(c:/Program Files/GRASS 6.4.SVN/etc/nad/conus): call fopen(c:/Program Files/GRASS 6.4.SVN/etc/nad/conus) - succeeded

pj_apply_gridshift(): used Conterminous United States
pj_open_lib(c:/Program): call fopen(c:/Program) - failed

I can confirm that this breaks not just with the conus grid file, but with any grid file.

Hamish

comment:14 by neteler, 12 years ago

Does the problem persist with proj-4.8.0?

in reply to:  14 ; comment:15 by hellik, 12 years ago

Replying to neteler:

Does the problem persist with proj-4.8.0?

tested with osgeo4w-wingrass6.4.3svn r52715 and standalone WinGRASS-6.4.3svn-r52715-323-Setup.exe on a win7-64bit-box and spearfish-dataset:

g.proj -j                                                                       
+proj=utm
+zone=13
+a=6378206.4
+rf=294.9786982
+no_defs
+nadgrids=C:/Program Files (x86)/GRASS GIS 6.4.3svn/etc/nad/conus
+to_meter=1.0
g.region -d
g.region -l                                                                     
north-west corner: long: 103:52:05.320652W lat: 44:30:06.305038N
north-east corner: long: 103:37:44.237721W lat: 44:29:56.868494N
south-east corner: long: 103:37:55.068504W lat: 44:22:13.20762N
south-west corner: long: 103:52:14.263003W lat: 44:22:22.602112N
center longitude:  103:44:59.72247W
center latitude:   44:26:09.745816N
rows:              477
cols:              634

I suggest to close the ticket.

Helmut

in reply to:  15 comment:16 by hellik, 12 years ago

Resolution: fixed
Status: newclosed

Replying to hellik:

I suggest to close the ticket.

closing ticket, reopen if needed.

Helmut

Note: See TracTickets for help on using tickets.