[GRASS-dev] grass location creation

Hi,
according to [1] I started to work on GRASS location Wizard. Since the
topic is rather complex, I would like to share some ideas with you,
before I go on it.

I tryed to prepare sort of diagram with the wizard screens and how
they could be organized [3] [4]. General idea is, that we offer to the
user graphical version of standard grass location-creation process. It
should be possible to define default bounding box coordinates based on
list of states or georeferenced file. Thi diagram is not as
transparent as I would like, sorry for this.

If anybody would have some clear picture about how the wizard should
be organized, please share your idea via mailing list or wiki page
[1].

Jachym

[1] http://grass.gdf-hannover.de/wiki/GRASS_Location_Wizard
[2] http://les-ejk.cz/tmp/grassstartup.png
[3] http://les-ejk.cz/tmp/wizard.png
[4] http://les-ejk.cz/tmp/wizard.dia
--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

Jachym Cepicky wrote:

according to [1] I started to work on GRASS location Wizard. Since the
topic is rather complex, I would like to share some ideas with you,
before I go on it.

I tryed to prepare sort of diagram with the wizard screens and how
they could be organized [3] [4]. General idea is, that we offer to the
user graphical version of standard grass location-creation process. It
should be possible to define default bounding box coordinates based on
list of states or georeferenced file. Thi diagram is not as
transparent as I would like, sorry for this.

If anybody would have some clear picture about how the wizard should
be organized, please share your idea via mailing list or wiki page
[1].

Jachym

[1] http://grass.gdf-hannover.de/wiki/GRASS_Location_Wizard
[2] http://les-ejk.cz/tmp/grassstartup.png
[3] http://les-ejk.cz/tmp/wizard.png
[4] http://les-ejk.cz/tmp/wizard.dia

you might look at Radim's GRASS location/mapset creation wizard for QGIS
for inspiration,
  http://article.gmane.org/gmane.comp.gis.grass.devel/9049

The screenshots listed there are no longer available (or at archive.org),
but maybe you can find them somewhere else, or just try it in GIS 0.8?

I think a big missing piece is (still) a non-interactive "save as
default region" option for g.region. Currently there is no tool to do
that outside of lib/init/set_data.c + lib/edit/edit_cellhd.c

Hamish

I have the QGIS version here :wink:

g.region -s would be great...

however - should it work from PERMANENT mapset only, or from any other
mapset too?

jachym

2007/3/7, Hamish <hamish_nospam@yahoo.com>:

Jachym Cepicky wrote:
> according to [1] I started to work on GRASS location Wizard. Since the
> topic is rather complex, I would like to share some ideas with you,
> before I go on it.
>
> I tryed to prepare sort of diagram with the wizard screens and how
> they could be organized [3] [4]. General idea is, that we offer to the
> user graphical version of standard grass location-creation process. It
> should be possible to define default bounding box coordinates based on
> list of states or georeferenced file. Thi diagram is not as
> transparent as I would like, sorry for this.
>
> If anybody would have some clear picture about how the wizard should
> be organized, please share your idea via mailing list or wiki page
> [1].
>
> Jachym
>
> [1] http://grass.gdf-hannover.de/wiki/GRASS_Location_Wizard
> [2] http://les-ejk.cz/tmp/grassstartup.png
> [3] http://les-ejk.cz/tmp/wizard.png
> [4] http://les-ejk.cz/tmp/wizard.dia

you might look at Radim's GRASS location/mapset creation wizard for QGIS
for inspiration,
  http://article.gmane.org/gmane.comp.gis.grass.devel/9049

The screenshots listed there are no longer available (or at archive.org),
but maybe you can find them somewhere else, or just try it in GIS 0.8?

I think a big missing piece is (still) a non-interactive "save as
default region" option for g.region. Currently there is no tool to do
that outside of lib/init/set_data.c + lib/edit/edit_cellhd.c

Hamish

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

2007/3/7, Hamish <hamish_nospam@yahoo.com>:

I think a big missing piece is (still) a non-interactive "save as
default region" option for g.region. Currently there is no tool to do
that outside of lib/init/set_data.c + lib/edit/edit_cellhd.c

The code is in r.in.gdal - should not be so hard to add it
to g.region.

Markus

On Mar 7, 2007, at 2:13 AM, Jachym Cepicky wrote:

I have the QGIS version here :wink:

g.region -s would be great...

however - should it work from PERMANENT mapset only, or from any other
mapset too?

if you are talking about saving as default region it should work from PERMANENT mapset only
as in GRASS you can change the files only in your current mapset
and the default region is stored in PERMANENT.
This would add an important missing piece - it was a real pain not to have it
when I started to work with the spearfish replacement data set and I tried
to work as a normal user (not editing the DEFAULT_WIND files) as my default
regions we set to 1,1,1 for locations where I used the EPSG code.

thanks for looking into it,

Helena

jachym

2007/3/7, Hamish <hamish_nospam@yahoo.com>:

Jachym Cepicky wrote:
> according to [1] I started to work on GRASS location Wizard. Since the
> topic is rather complex, I would like to share some ideas with you,
> before I go on it.
>
> I tryed to prepare sort of diagram with the wizard screens and how
> they could be organized [3] [4]. General idea is, that we offer to the
> user graphical version of standard grass location-creation process. It
> should be possible to define default bounding box coordinates based on
> list of states or georeferenced file. Thi diagram is not as
> transparent as I would like, sorry for this.
>
> If anybody would have some clear picture about how the wizard should
> be organized, please share your idea via mailing list or wiki page
> [1].
>
> Jachym
>
> [1] http://grass.gdf-hannover.de/wiki/GRASS_Location_Wizard
> [2] http://les-ejk.cz/tmp/grassstartup.png
> [3] http://les-ejk.cz/tmp/wizard.png
> [4] http://les-ejk.cz/tmp/wizard.dia

you might look at Radim's GRASS location/mapset creation wizard for QGIS
for inspiration,
  http://article.gmane.org/gmane.comp.gis.grass.devel/9049

The screenshots listed there are no longer available (or at archive.org),
but maybe you can find them somewhere else, or just try it in GIS 0.8?

I think a big missing piece is (still) a non-interactive "save as
default region" option for g.region. Currently there is no tool to do
that outside of lib/init/set_data.c + lib/edit/edit_cellhd.c

Hamish

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

hi,

patch for g.region is part of this email

however, it does not work :frowning: I took the code from r.in.gdal (main.c
arround lines 526-546), everything looks good.. but it does not work
:frowning:

Could anybody have a look at it? Thanks!

Jachym

2007/3/7, Markus Neteler <neteler@itc.it>:

2007/3/7, Hamish <hamish_nospam@yahoo.com>:
>I think a big missing piece is (still) a non-interactive "save as
>default region" option for g.region. Currently there is no tool to do
>that outside of lib/init/set_data.c + lib/edit/edit_cellhd.c

The code is in r.in.gdal - should not be so hard to add it
to g.region.

Markus

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

(attachments)

g.region.patch (1.35 KB)

Jachym Cepicky wrote:

patch for g.region is part of this email

however, it does not work :frowning: I took the code from r.in.gdal (main.c
arround lines 526-546), everything looks good.. but it does not work
:frowning:

+ if (flag.savedefault->answer) {
+ char *location = G_location_path();
+ char *path = (char *) G_malloc(sizeof(location)+64);
+ strcpy(path,location);
+ strcat(path,"/PERMANENT/");
+ G__put_window( &window, path, "DEFAULT_WIND" );
+ }

The second argument to G__put_window has to be an "element", i.e. a
directory in the current mapset. r.in.gdal uses "../PERMANENT", which
works because the element is simply concatenated onto the path to the
mapset directory.

I suggest that you adopt the same approach, i.e.:

  G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );

--
Glynn Clements <glynn@gclements.plus.com>

Thanks, Glynn, worked perfect

Patch commited

jachym

2007/3/8, Glynn Clements <glynn@gclements.plus.com>:

Jachym Cepicky wrote:

> patch for g.region is part of this email
>
> however, it does not work :frowning: I took the code from r.in.gdal (main.c
> arround lines 526-546), everything looks good.. but it does not work
> :frowning:

> + if (flag.savedefault->answer) {
> + char *location = G_location_path();
> + char *path = (char *) G_malloc(sizeof(location)+64);
> + strcpy(path,location);
> + strcat(path,"/PERMANENT/");
> + G__put_window( &window, path, "DEFAULT_WIND" );
> + }

The second argument to G__put_window has to be an "element", i.e. a
directory in the current mapset. r.in.gdal uses "../PERMANENT", which
works because the element is simply concatenated onto the path to the
mapset directory.

I suggest that you adopt the same approach, i.e.:

        G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );

--
Glynn Clements <glynn@gclements.plus.com>

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

Glynn Clements wrote:

> + if (flag.savedefault->answer) {
> + char *location = G_location_path();
> + char *path = (char *) G_malloc(sizeof(location)+64);
> + strcpy(path,location);
> + strcat(path,"/PERMANENT/");
> + G__put_window( &window, path, "DEFAULT_WIND" );
> + }

The second argument to G__put_window has to be an "element", i.e. a
directory in the current mapset. r.in.gdal uses "../PERMANENT", which
works because the element is simply concatenated onto the path to the
mapset directory.

I suggest that you adopt the same approach, i.e.:

  G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );

as this should only be working if the current mapset is PERMANENT,
could/should that be shortened to "."?

G__put_window( &window, ".", "DEFAULT_WIND" );

Hamish

Hamish wrote:

> > + if (flag.savedefault->answer) {
> > + char *location = G_location_path();
> > + char *path = (char *) G_malloc(sizeof(location)+64);
> > + strcpy(path,location);
> > + strcat(path,"/PERMANENT/");
> > + G__put_window( &window, path, "DEFAULT_WIND" );
> > + }
>
> The second argument to G__put_window has to be an "element", i.e. a
> directory in the current mapset. r.in.gdal uses "../PERMANENT", which
> works because the element is simply concatenated onto the path to the
> mapset directory.
>
> I suggest that you adopt the same approach, i.e.:
>
> G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );

as this should only be working if the current mapset is PERMANENT,
could/should that be shortened to "."?

G__put_window( &window, ".", "DEFAULT_WIND" );

If it only needs to work in PERMANENT, use "".

--
Glynn Clements <glynn@gclements.plus.com>

On Thu, 8 Mar 2007, Jachym Cepicky wrote:

Thanks, Glynn, worked perfect

Patch commited

jachym

2007/3/8, Glynn Clements <glynn@gclements.plus.com>:

Jachym Cepicky wrote:

> patch for g.region is part of this email
>
> however, it does not work :frowning: I took the code from r.in.gdal (main.c
> arround lines 526-546), everything looks good.. but it does not work
> :frowning:

> + if (flag.savedefault->answer) {
> + char *location = G_location_path();
> + char *path = (char *) G_malloc(sizeof(location)+64);
> + strcpy(path,location);
> + strcat(path,"/PERMANENT/");
> + G__put_window( &window, path, "DEFAULT_WIND" );
> + }

The second argument to G__put_window has to be an "element", i.e. a
directory in the current mapset. r.in.gdal uses "../PERMANENT", which
works because the element is simply concatenated onto the path to the
mapset directory.

I suggest that you adopt the same approach, i.e.:

        G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );

--
Glynn Clements <glynn@gclements.plus.com>

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

Hello Jachym

On Thu, 8 Mar 2007, Jachym Cepicky wrote:

Thanks, Glynn, worked perfect

Patch commited

Is there a check that the mapset is PERMANENT? It should fail with an error if the new flag is specified and the mapset isn't PERMANENT, like I *think* g.proj -c without location= specified does and like I *think* Helena also suggested?

This is really important functionality to have - good that we're finally getting round to adding it :wink:

Paul

jachym

2007/3/8, Glynn Clements <glynn@gclements.plus.com>:

Jachym Cepicky wrote:

> patch for g.region is part of this email
>
> however, it does not work :frowning: I took the code from r.in.gdal (main.c
> arround lines 526-546), everything looks good.. but it does not work
> :frowning:

> + if (flag.savedefault->answer) {
> + char *location = G_location_path();
> + char *path = (char *) G_malloc(sizeof(location)+64);
> + strcpy(path,location);
> + strcat(path,"/PERMANENT/");
> + G__put_window( &window, path, "DEFAULT_WIND" );
> + }

The second argument to G__put_window has to be an "element", i.e. a
directory in the current mapset. r.in.gdal uses "../PERMANENT", which
works because the element is simply concatenated onto the path to the
mapset directory.

I suggest that you adopt the same approach, i.e.:

        G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );

--
Glynn Clements <glynn@gclements.plus.com>

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

Hi:

general/g.region/cmd/main.c:

851 if (flag.savedefault->answer)
852 if (strcmp(G_mapset(),"PERMANENT") == 0)
853 G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );
854 else
855 G_warning(_("You are not in mapset PERMANENT,
default region -> remains untached"));

is it sufficient?

Jachym

2007/3/9, Paul Kelly <paul-grass@stjohnspoint.co.uk>:

Hello Jachym

On Thu, 8 Mar 2007, Jachym Cepicky wrote:

> Thanks, Glynn, worked perfect
>
> Patch commited

Is there a check that the mapset is PERMANENT? It should fail with an
error if the new flag is specified and the mapset isn't PERMANENT, like I
*think* g.proj -c without location= specified does and like I *think*
Helena also suggested?

This is really important functionality to have - good that we're finally
getting round to adding it :wink:

Paul

>
> jachym
>
> 2007/3/8, Glynn Clements <glynn@gclements.plus.com>:
>>
>> Jachym Cepicky wrote:
>>
>> > patch for g.region is part of this email
>> >
>> > however, it does not work :frowning: I took the code from r.in.gdal (main.c
>> > arround lines 526-546), everything looks good.. but it does not work
>> > :frowning:
>>
>> > + if (flag.savedefault->answer) {
>> > + char *location = G_location_path();
>> > + char *path = (char *) G_malloc(sizeof(location)+64);
>> > + strcpy(path,location);
>> > + strcat(path,"/PERMANENT/");
>> > + G__put_window( &window, path, "DEFAULT_WIND" );
>> > + }
>>
>> The second argument to G__put_window has to be an "element", i.e. a
>> directory in the current mapset. r.in.gdal uses "../PERMANENT", which
>> works because the element is simply concatenated onto the path to the
>> mapset directory.
>>
>> I suggest that you adopt the same approach, i.e.:
>>
>> G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );
>>
>> --
>> Glynn Clements <glynn@gclements.plus.com>
>>
>
> --
> Jachym Cepicky
> e-mail: jachym.cepicky gmail com
> URL: http://les-ejk.cz
> GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
>
> _______________________________________________
> grass-dev mailing list
> grass-dev@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

Jachym Cepicky wrote:

general/g.region/cmd/main.c:

851 if (flag.savedefault->answer)
852 if (strcmp(G_mapset(),"PERMANENT") == 0)
853 G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );
854 else
855 G_warning(_("You are not in mapset PERMANENT, default region -> remains untached"));

is it sufficient?

  853 G__put_window( &window, "", "DEFAULT_WIND" );

If you're already in PERMANENT, there's no need for "../PERMANENT".

Otherwise, fine.

--
Glynn Clements <glynn@gclements.plus.com>

On Fri, 9 Mar 2007, Glynn Clements wrote:

Jachym Cepicky wrote:

general/g.region/cmd/main.c:

851 if (flag.savedefault->answer)
852 if (strcmp(G_mapset(),"PERMANENT") == 0)
853 G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );
854 else
855 G_warning(_("You are not in mapset PERMANENT, default region -> remains untached"));

is it sufficient?

853 G__put_window( &window, "", "DEFAULT_WIND" );

If you're already in PERMANENT, there's no need for "../PERMANENT".

Otherwise, fine.

Yes. My reason for the check was so users cannot overwrite the default region by accident just if they happen to own the PERMANENT mapset, without actually selecting it. Arguably it should be a fatal error rather than a warning but it's fine.

Paul

--
Glynn Clements <glynn@gclements.plus.com>

Ok,

I also added brackets to make it a bit more safer for reading..

thanks

jachym

2007/3/9, Glynn Clements <glynn@gclements.plus.com>:

Jachym Cepicky wrote:

> general/g.region/cmd/main.c:
>
> 851 if (flag.savedefault->answer)
> 852 if (strcmp(G_mapset(),"PERMANENT") == 0)
> 853 G__put_window( &window, "../PERMANENT", "DEFAULT_WIND" );
> 854 else
> 855 G_warning(_("You are not in mapset PERMANENT, default region -> remains untached"));
>
> is it sufficient?

  853 G__put_window( &window, "", "DEFAULT_WIND" );

If you're already in PERMANENT, there's no need for "../PERMANENT".

Otherwise, fine.

--
Glynn Clements <glynn@gclements.plus.com>

--
Jachym Cepicky
e-mail: jachym.cepicky gmail com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

Jachym Cepicky wrote:

G_warning(_("You are not in mapset PERMANENT, default region ->
remains untached"));

"-> remains untached" to "has not been modified"

or

"You must be in the PERMANENT mapset to change the default region."

?

Hamish