[GRASS-user] working on a mounted external disk

Hello,

has anybody ever had problems accessing a gisdbase located on an
external disk ? In my case, I can open a grass session in a distant
location/mapset :

        grass65 /mnt/path_to_my_disk/my_location/topo
        

From within this place, everything works well, OK.

If I start grass from my home directory and try to reproject data from
the distant directory :

        grass65 /home/vincent/my_gisdbase/my_location/my_mapset
        
        r.proj input=dem50 location=/mnt/path_to_my_disk/my_location
        mapset=topo output=dem50
        
Then an error occurs :

        ERREUR :Mapset <topo> in input location
        </mnt/path_to_my_disk/my_location/> - not found

whereas the disk is properly mounted there and accessible...

Any idea on why grass seems not to see the mounted directory ?

Thank you
Vincent

On 08/04/09 10:31, Vincent Bain wrote:

Hello,

has anybody ever had problems accessing a gisdbase located on an
external disk ? In my case, I can open a grass session in a distant
location/mapset :

        grass65 /mnt/path_to_my_disk/my_location/topo
        

From within this place, everything works well, OK.

If I start grass from my home directory and try to reproject data from
the distant directory :

        grass65 /home/vincent/my_gisdbase/my_location/my_mapset
                r.proj input=dem50 location=/mnt/path_to_my_disk/my_location
        mapset=topo output=dem50
        Then an error occurs :

        ERREUR :Mapset <topo> in input location
        </mnt/path_to_my_disk/my_location/> - not found

whereas the disk is properly mounted there and accessible...

Any idea on why grass seems not to see the mounted directory ?

You need to use the dbase= option of r.proj to direct it to another database. In your case it is looking for a location called "/mnt/path_to_my_disk/my_location/" in your current gisdatabase.

Moritz

Thank you Moritz,

I tried to specify the path to the target database location this way :

        r.proj input=dem50 location=/mnt/path_to_my_disk/my_location
        mapset=topo dbase=/mnt/path_to_my_disk/ output=dem50
        
unfortunately it still returns the same error.

Well, maybe I should change the title of this post, because I notice now
that the problem is the same with "resident" paths on the machine
(apparently nothing to deal with mounted directory).

Vincent

Le mercredi 08 avril 2009 à 10:48 +0200, Moritz Lennert a écrit :

You need to use the dbase= option of r.proj to direct it to another
database. In your case it is looking for a location called
"/mnt/path_to_my_disk/my_location/" in your current gisdatabase.

Moritz

On 08/04/09 11:51, Vincent Bain wrote:

Thank you Moritz,

I tried to specify the path to the target database location this way :

        r.proj input=dem50 location=/mnt/path_to_my_disk/my_location
        mapset=topo dbase=/mnt/path_to_my_disk/ output=dem50

this should be:

r.proj input=dem50 location=my_location
          mapset=topo dbase=/mnt/path_to_my_disk/ output=dem50

If you give it location=/mnt/path_to_my_disk/my_location
it "thinks" that the location is called "/mnt/path_to_my_disk/my_location" as the error message indicates:

ERREUR :Mapset <topo> in input location
         </mnt/path_to_my_disk/my_location/> - not found

Moritz

        unfortunately it still returns the same error.

Well, maybe I should change the title of this post, because I notice now
that the problem is the same with "resident" paths on the machine
(apparently nothing to deal with mounted directory).

Vincent

Le mercredi 08 avril 2009 à 10:48 +0200, Moritz Lennert a écrit :

You need to use the dbase= option of r.proj to direct it to another database. In your case it is looking for a location called "/mnt/path_to_my_disk/my_location/" in your current gisdatabase.

Moritz

OH, that simple ! shame on me :frowning:
Sorry for being so dazed...

A detail concerning r.proj in that context of distinct gisdbases :
if the distant location has the same name as the current (i.e. in my
example both locations are called 'my_location'), then the command
returns a comprehensible error :

ERROR: You have to use a different location for input than the current

It would be nice if the dbase argument was checked /before/ the location
argument, in order to admit same location names, not necessarily meaning
that we project data in an identical projection system.

Vincent

Le mercredi 08 avril 2009 à 13:41 +0200, Moritz Lennert a écrit :

this should be:

r.proj input=dem50 location=my_location
          mapset=topo dbase=/mnt/path_to_my_disk/ output=dem50

If you give it location=/mnt/path_to_my_disk/my_location
it "thinks" that the location is called
"/mnt/path_to_my_disk/my_location" as the error message indicates:

ERREUR :Mapset <topo> in input location
         </mnt/path_to_my_disk/my_location/> - not found

Moritz

On 08/04/09 14:13, Vincent Bain wrote:

It would be nice if the dbase argument was checked /before/ the location
argument, in order to admit same location names, not necessarily meaning
that we project data in an identical projection system.

Try this (untested):

Index: raster/r.proj/main.c

--- raster/r.proj/main.c (révision 36609)
+++ raster/r.proj/main.c (copie de travail)
@@ -219,7 +219,7 @@

      setname = imapset->answer ? imapset->answer : G_store(G_mapset());

- if (strcmp(inlocation->answer, G_location()) == 0)
+ if (strcmp(inlocation->answer, G_location()) == 0 && (!indbase->answer || strcmp(indbase->answer, G_gisdbase()) == 0))
    G_fatal_error(_("You have to use a different location for input than the current"));

      G_get_window(&outcellhd);

Moritz

In raster/r.proj/main.c, line 208 I wrote :

        if (strcmp(inlocation->answer, G_location()) == 0 &&
           !indbase->answer || strcmp(indbase->answer, G_gisdbase())==
        0))
          G_fatal_error(_("Input and output locations can not be the
        same"));
        
            G_get_window(&outcellhd);

Then compiled and installed again, but the error remains, and what's
more puzzling to me is that the message string is different from what I
have in the modified file ("You have to use a different location for
input than the current")...

What have I done wrong ?

VB

Le mercredi 08 avril 2009 à 14:32 +0200, Moritz Lennert a écrit :

On 08/04/09 14:13, Vincent Bain wrote:

> It would be nice if the dbase argument was checked /before/ the location
> argument, in order to admit same location names, not necessarily meaning
> that we project data in an identical projection system.

Try this (untested):

Index: raster/r.proj/main.c

--- raster/r.proj/main.c (révision 36609)
+++ raster/r.proj/main.c (copie de travail)
@@ -219,7 +219,7 @@

      setname = imapset->answer ? imapset->answer : G_store(G_mapset());

- if (strcmp(inlocation->answer, G_location()) == 0)
+ if (strcmp(inlocation->answer, G_location()) == 0 &&
(!indbase->answer || strcmp(indbase->answer, G_gisdbase()) == 0))
    G_fatal_error(_("You have to use a different location for input than
the current"));

      G_get_window(&outcellhd);

Moritz

On 08/04/09 15:37, Vincent Bain wrote:

In raster/r.proj/main.c, line 208 I wrote :

        if (strcmp(inlocation->answer, G_location()) == 0 &&
           !indbase->answer || strcmp(indbase->answer, G_gisdbase())==
        0))
          G_fatal_error(_("Input and output locations can not be the
        same"));
                    G_get_window(&outcellhd);

Then compiled and installed again, but the error remains, and what's
more puzzling to me is that the message string is different from what I
have in the modified file ("You have to use a different location for
input than the current")...

What have I done wrong ?

This sounds like you modified and compiled a grass6 version, but are running grass7.

Apparently a fix for this issue done by Markus a long time ago in grass6, but this got lost, when (IIUC) r.proj.seg became r.proj in grass7.

Markus' fix was this:

-if (strcmp(inlocation->answer, G_location()) == 0)
- G_fatal_error(_("You have to use a different location for input
- than the current"));
+ if (!indbase->answer && strcmp(inlocation->answer, G_location()) == 0) + G_fatal_error(_("Input and output locations can not be the same"));

but this was never applied to r.proj.seg. His fix does not take into account the case where someone gives a value for dbase, but this is the same as the current location. Probably highly improbable, but not impossible, so my fix is a bit more complete...

So, to make this story short:

- You have to figure out which version of grass you are working with.
- In grass6.3+ this shouldn't be an issue, but it is in grass6.2 and before and again in grass7.
- The message ""You have to use a different location for input than the current" is in grass6.2 and before and in grass7, but was changed to "Input and output locations can not be the same" in grass6.3+.

I'll apply my fix (but using Markus' wording) grass7, but I'll leave devel6 alone as the Markus' fix should handle most cases.

Moritz

Apparently a fix for this issue done by Markus a long time ago in
grass6, but this got lost, when (IIUC) r.proj.seg became r.proj in grass7.

OK, I've got it : I made changes to raster/r.proj/main.c instead of
raster/r.proj.seg/main.c

Now it works fine with the right main.c file !

Thank you,
Vincent