[GRASS-dev] [GRASS GIS] #654: g.proj -c fails with ERROR: region for current mapset is not set run "g.region"

#654: g.proj -c fails with ERROR: region for current mapset is not set run
"g.region"
----------------------+-----------------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Keywords: g.proj | Platform: All
      Cpu: All |
----------------------+-----------------------------------------------------
As reported on grass-user
{{{
  g.proj -c georef=swilAlphaTIFF.tif location=tset
}}}

fails with recent builds. I can reproduce on linux.

I traced this back to r37726 where wind_format.c's format_double()
uses G_projection() which wants to check the projection type (and that
hasn't been created yet).

I think the solution is to create a new lib fn
{{{
  char *G_format_number(double value, int dp);
}}}

so modules don't have to lie to G_format_northing() about their projection
type in order to get numeric output from lat/lon locations. then we can
get rid of G_projection() from format_double().

Either that or finally implement GRASS_DMS_STYLE variable and temporarily
set that to numeric degree style.

Hamish

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

#654: g.proj -c fails with ERROR: region for current mapset is not set run
"g.region"
-----------------------+----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: critical | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: g.proj
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Comment (by hamish):

Replying to [ticket:654 hamish]:
> wind_format.c's format_double() uses G_projection() which wants
> to check the projection type (and that hasn't been created yet).

actually it has in a way,

the top two lines of PERMANENT/DEFAULT_WIND are written:
{{{
proj: 99
zone: 0
}}}

I'm not really sure if that helps though.

Hamish

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

#654: g.proj -c fails with ERROR: region for current mapset is not set run
"g.region"
-----------------------+----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: critical | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: g.proj
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Comment (by hamish):

> I think the solution is to create a new lib fn
> char *G_format_number(double value, int dp);

better, path of least change: allow G_format_northing() etc to accept "-1"
for projection type which in this instance can mean use "%.15g"
independent of the projection.

Hamish

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

#654: g.proj -c fails with ERROR: region for current mapset is not set run
"g.region"
-----------------------+----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: critical | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: g.proj
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Comment (by hamish):

patch attached, but that's the easy part. It turns out a lot of modules
are already using proj == -1 or similar to fool G_format_*() into
outputting numerical output instead of DMS for certain tasks. i.e. this
patch, or something like it, is long overdue.

need to audit all of the custom workarounds before applying..

Hamish

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

#654: g.proj -c fails with ERROR: region for current mapset is not set run
"g.region"
-----------------------+----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: critical | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: g.proj
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Comment (by hamish):

fixed in r37983, r37979, r37981.

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

#654: g.proj -c fails with ERROR: region for current mapset is not set run
"g.region"
-----------------------+----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: critical | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: fixed | Keywords: g.proj
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Changes (by hamish):

  * status: new => closed
  * resolution: => fixed

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

#654: g.proj -c fails with ERROR: region for current mapset is not set run
"g.region"
-----------------------+----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: critical | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: fixed | Keywords: g.proj
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Comment (by kyngchaos):

This seems to have fixed #648 also, at least for me applied to RC5 source
on OSX.

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

#654: g.proj -c fails with ERROR: region for current mapset is not set run
"g.region"
-----------------------+----------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: critical | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: fixed | Keywords: g.proj
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Comment (by hamish):

Replying to [comment:6 kyngchaos]:
> This seems to have fixed #648 also, at least for me applied to
> RC5 source on OSX.

yes, it should do. both new mapset creation using "g.proj -c" and
"g.region -d" would leave broken mapsets. :-/

Hamish

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