[GRASS5] Re: g.remove and reclassed maps

Markus Neteler neteler at geog.uni-hannover.de
Mon Feb 19 05:24:49 EST 2001


Hi Hudia
[cc to grass5]

many thanks for implementing the reclass-check!

On Sun, Feb 18, 2001 at 02:42:03AM +0900, Huidae Cho wrote:
> From: Markus Neteler <neteler at geog.uni-hannover.de>
> > On Thu, Feb 15, 2001 at 11:37:29PM +0900, Huidae Cho wrote:
> > > From: Markus Neteler <neteler at geog.uni-hannover.de>
> > > > 
> > > > Hi Huidae,
> > > > 
> > > > hope you got the sockets compiled now! Thanks for all your
> > > > work on the d.what.* modules.
> > > > 
> > > Hi Markus,
> > > 
> > > Yeah! It's great! Socket driver now works well. it's fast and nice :-)
> > 
> > Superb!
> >  
> > > > If you don't mind, I have another thing: g.remove and reclassed maps
> > > > interact in a somewhat dangerous way. You could remove the base
> > > > map for a reclassed map without being notified. Then your reclassed map
> > > > become unusable of course. 
> > > > It would be very good to have a check added to g.remove and g.rename
> > > > which tests if the map is "parent" to a reclassed map. Then the
> > > > user should be asked if the map should be really deleted/renamed.
> > > > 
> > > > To be honest: I am unable to program that. Perhaps you could
> > > > look into this?
> > > > 
> > > 
> > > OK, BTW: how can i know if map is reclassed or not?
> > > Anyway, i'll look into it.
> > You can use:
> > 
> >     if (G_is_reclass (old_name, G_mapset(), rname, rmapset) > 0)
> >     {
> >       sprintf(buf, "%s is a reclass of another map. Exiting.\n Use r.mapcalc to 
> >                      generate a copy of input map %s to work with", old_name, old_name);
> >           G_fatal_error(buf);
> >     }
> > 
> > See:
> > src/raster/r.reclass/cmd/main.c
> > 
> > for an example.
> > 
> 
> Hi Markus,
> 
> I've added G_is_reclassed_by() function to get child reclass maps list and
> cell_misc/reclassed_by file to store this list.  Without this file,
> we should search all the maps' cellhd in the current location to get list
> (yes, all MAPSETS) and it may take long time even if it has only one mapset.
> 
> So i decided to create this new file.

This is a good idea.

> affected modules are:
> 
> 	g.remove	just prints warning if any child maps exist.
> 	g.rename	do rename specified parent and search all
> 			child maps to change parent's name
> 	g.copy		remove "reclassed_by" file after copying all files
> 			because new file is not reclassed by anything
> 
> Could you test this new features?

I have tested and everything works o.k. Even a great idea within
g.rename.

I have updated the programmer's manual accordingly.

Thanks for this important improvement.

 Markus

PS: Eric Miller's sockets functions are added to progmangrass50.pdf  as 
    well. Thanks to Eric for writing this part of manual.

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list