[GRASS-dev] [GRASS GIS] #489: g.setproj: sets proj info with missing UTM zone

#489: g.setproj: sets proj info with missing UTM zone
-----------------------+----------------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: minor | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Keywords: g.setproj | Platform: Linux
      Cpu: x86-32 |
-----------------------+----------------------------------------------------
Hi,

with g.setproj it is possible to set the region so that the resulting
PROJ_INFO file is missing the zone: field. Perhaps
this is because 'g.region -p' says the zone is -55 while g.proj
had 55(S)?

{{{
G640rc2> g.setproj
...
Would you still like to change some of the parameters?(y/n) [n] y
WARNING: Zone in default geographic region definition: -55
          is different from zone in PROJ_INFO file: 55
...
Please specify projection name
>utm
}}}
[ do we want a space after the '>' prompt? ]
{{{
Do you wish to specify a geodetic datum for this location?(y/n) [y] y

Please specify datum name
>custom
}}}
[I did want the datum to be Australia GD 1994, but that's not a choice]
{{{
Please specify ellipsoid name
>grs80

Please specify datum transformation parameters
>towgs84=0,0,0

Parameters to be used are:
"towgs84=0,0,0"
Is this correct?(y/n) [y] y
South Hemisphere(y/n) [n] y
The UTM zone is now set to 55
Do you want to change the UTM zone?(y/n) [n] n
UTM zone information has not been updated

Projection information has been recorded for this location
}}}

then

{{{
  g.proj -p
-PROJ_INFO-------------------------------------------------
name : Universe Transverse Mercator
towgs84 : 0,0,0
proj : utm
ellps : grs80
a : 6378137.0000000000
es : 0.0066943800
f : 298.2572221010
south : defined
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1.0
}}}

and then r.in.gdal segfaults when attempting the matching proj settings
comparison. (strcmp() missing key value in lib/gis/make_loc.c)

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/489&gt;
GRASS GIS <http://grass.osgeo.org>

#489: g.setproj: sets proj info with missing UTM zone
----------------------+-----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: minor | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: g.setproj
  Platform: Linux | Cpu: x86-32
----------------------+-----------------------------------------------------
Old description:

Hi,

with g.setproj it is possible to set the region so that the resulting
PROJ_INFO file is missing the zone: field. Perhaps
this is because 'g.region -p' says the zone is -55 while g.proj
had 55(S)?

{{{
G640rc2> g.setproj
...
Would you still like to change some of the parameters?(y/n) [n] y
WARNING: Zone in default geographic region definition: -55
         is different from zone in PROJ_INFO file: 55
...
Please specify projection name
>utm
}}}
[ do we want a space after the '>' prompt? ]
{{{
Do you wish to specify a geodetic datum for this location?(y/n) [y] y

Please specify datum name
>custom
}}}
[I did want the datum to be Australia GD 1994, but that's not a choice]
{{{
Please specify ellipsoid name
>grs80

Please specify datum transformation parameters
>towgs84=0,0,0

Parameters to be used are:
"towgs84=0,0,0"
Is this correct?(y/n) [y] y
South Hemisphere(y/n) [n] y
The UTM zone is now set to 55
Do you want to change the UTM zone?(y/n) [n] n
UTM zone information has not been updated

Projection information has been recorded for this location
}}}

then

{{{
g.proj -p
-PROJ_INFO-------------------------------------------------
name : Universe Transverse Mercator
towgs84 : 0,0,0
proj : utm
ellps : grs80
a : 6378137.0000000000
es : 0.0066943800
f : 298.2572221010
south : defined
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1.0
}}}

and then r.in.gdal segfaults when attempting the matching proj settings
comparison. (strcmp() missing key value in lib/gis/make_loc.c)

Hamish

New description:

Hi,

with g.setproj it is possible to set the region so that the resulting
PROJ_INFO file is missing the zone: field. Perhaps
this is because 'g.region -p' says the zone is -55 while g.proj
had ?

{{{
G640rc2> g.setproj
...
Would you still like to change some of the parameters?(y/n) [n] y
WARNING: Zone in default geographic region definition: -55
          is different from zone in PROJ_INFO file: 55
...
Please specify projection name
>utm
}}}
[ do we want a space after the '>' prompt? ]
{{{
Do you wish to specify a geodetic datum for this location?(y/n) [y] y

Please specify datum name
>custom
}}}
[I did want the datum to be Australia GD 1994, but that's not a choice]
{{{
Please specify ellipsoid name
>grs80

Please specify datum transformation parameters
>towgs84=0,0,0

Parameters to be used are:
"towgs84=0,0,0"
Is this correct?(y/n) [y] y
South Hemisphere(y/n) [n] y
The UTM zone is now set to 55
Do you want to change the UTM zone?(y/n) [n] n
UTM zone information has not been updated

Projection information has been recorded for this location
}}}

then

{{{
  g.proj -p
-PROJ_INFO-------------------------------------------------
name : Universe Transverse Mercator
towgs84 : 0,0,0
proj : utm
ellps : grs80
a : 6378137.0000000000
es : 0.0066943800
f : 298.2572221010
south : defined
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1.0
}}}

and then r.in.gdal segfaults when attempting the matching proj settings
comparison. (strcmp() missing key value in lib/gis/make_loc.c)

Hamish

Comment (by neteler):

The code chunk in general/g.setproj/main.c (see
[source:grass/branches/develbranch_6/general/g.setproj/main.c#L413]) is:
{{{
             if (parm->ask) {
                 if (G_strcasecmp(desc->type, "bool") == 0) {
                     if (G_yes((char *)desc->desc, 0)) {
                         G_set_key_value(desc->key, "defined",
out_proj_keys);
                         if (G_strcasecmp(parm->name, "SOUTH") == 0)
                             cellhd.zone = -abs(cellhd.zone);
                     }
                 }
}}}

and in lib/proj/get_proj.c it is (line 154)
{{{
             /* if zone is negative, write abs(zone) and define south */
             info->zone = -info->zone;
}}}

So it seems to be valid?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/489#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#489: g.setproj: sets proj info with missing UTM zone
----------------------+-----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: minor | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: g.setproj
  Platform: Linux | Cpu: x86-32
----------------------+-----------------------------------------------------
Old description:

Hi,

with g.setproj it is possible to set the region so that the resulting
PROJ_INFO file is missing the zone: field. Perhaps
this is because 'g.region -p' says the zone is -55 while g.proj
had ?

{{{
G640rc2> g.setproj
...
Would you still like to change some of the parameters?(y/n) [n] y
WARNING: Zone in default geographic region definition: -55
         is different from zone in PROJ_INFO file: 55
...
Please specify projection name
>utm
}}}
[ do we want a space after the '>' prompt? ]
{{{
Do you wish to specify a geodetic datum for this location?(y/n) [y] y

Please specify datum name
>custom
}}}
[I did want the datum to be Australia GD 1994, but that's not a choice]
{{{
Please specify ellipsoid name
>grs80

Please specify datum transformation parameters
>towgs84=0,0,0

Parameters to be used are:
"towgs84=0,0,0"
Is this correct?(y/n) [y] y
South Hemisphere(y/n) [n] y
The UTM zone is now set to 55
Do you want to change the UTM zone?(y/n) [n] n
UTM zone information has not been updated

Projection information has been recorded for this location
}}}

then

{{{
g.proj -p
-PROJ_INFO-------------------------------------------------
name : Universe Transverse Mercator
towgs84 : 0,0,0
proj : utm
ellps : grs80
a : 6378137.0000000000
es : 0.0066943800
f : 298.2572221010
south : defined
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1.0
}}}

and then r.in.gdal segfaults when attempting the matching proj settings
comparison. (strcmp() missing key value in lib/gis/make_loc.c)

Hamish

New description:

Hi,

with g.setproj it is possible to set the region so that the resulting
PROJ_INFO file is missing the zone: field. Perhaps
this is because 'g.region -p' says the zone is -55 while g.proj
had 55(S)?

{{{
G640rc2> g.setproj
...
Would you still like to change some of the parameters?(y/n) [n] y
WARNING: Zone in default geographic region definition: -55
          is different from zone in PROJ_INFO file: 55
...
Please specify projection name
>utm
}}}
[ do we want a space after the '>' prompt? ]
{{{
Do you wish to specify a geodetic datum for this location?(y/n) [y] y

Please specify datum name
>custom
}}}
[I did want the datum to be Australia GD 1994, but that's not a choice]
{{{
Please specify ellipsoid name
>grs80

Please specify datum transformation parameters
>towgs84=0,0,0

Parameters to be used are:
"towgs84=0,0,0"
Is this correct?(y/n) [y] y
South Hemisphere(y/n) [n] y
The UTM zone is now set to 55
Do you want to change the UTM zone?(y/n) [n] n
UTM zone information has not been updated

Projection information has been recorded for this location
}}}

then

{{{
  g.proj -p
-PROJ_INFO-------------------------------------------------
name : Universe Transverse Mercator
towgs84 : 0,0,0
proj : utm
ellps : grs80
a : 6378137.0000000000
es : 0.0066943800
f : 298.2572221010
south : defined
-PROJ_UNITS------------------------------------------------
unit : meter
units : meters
meters : 1.0
}}}

and then r.in.gdal segfaults when attempting the matching proj settings
comparison. (strcmp() missing key value in lib/gis/make_loc.c)

Hamish

Comment (by hamish):

[undid "55(S)" edit in description; a while back I filed an upstream trac
wish to have the orig. desc. box minimized by default to avoid accidental
edits, it got some attention]

the problem is not that the UTM zone's pos/neg sign comes out wrong, the
problem is that the zone: term is not written at all!

Hamish

ps- in linking to source code via trac if you skip giving a rev number you
still need to use @, e.g.:
  source:grass/branches/develbranch_6/general/g.setproj/main.c@#L413

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/489#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#489: g.setproj: sets proj info with missing UTM zone
----------------------+-----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: g.setproj
  Platform: Linux | Cpu: x86-32
----------------------+-----------------------------------------------------
Changes (by hamish):

  * priority: minor => major

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/489#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#489: g.setproj: sets proj info with missing UTM zone
--------------------------------+-------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Projections/Datums | Version: 6.4.0 RCs
Keywords: g.setproj | Platform: Linux
      Cpu: x86-32 |
--------------------------------+-------------------------------------------
Changes (by hamish):

  * component: Default => Projections/Datums

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/489#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>