[GRASS-dev] Re: gui startup bug (new locn by epsg code)

Paul Kelly paul-grass at stjohnspoint.co.uk
Tue Jan 30 13:00:12 EST 2007


Hello Maris

On Tue, 30 Jan 2007, Maris Nartiss wrote:

> Hi,
>
> I can confirm this bug.
>
> Problem is - this EPSG code requires aditional user input from comand
> line - just try to run "g.proj -c proj4=+init=epsg:2258
> location=EpsgBug" whithin GRASS session and g.proj will ask for
> aditional parameters. As current tcl/tk code does not open xterm for
> g.proj operations, it stucks on waiting user input from nonexisting
> xterm app.

The attached patch will run g.proj in a terminal Window in case it needs 
to prompt for user input. I think it is a good workaround for the time 
being?

> IMHO this should be fixed in g.proj first to make it independend from
> interactive comandline usage and then startup screen can be fixed to
> use new g.proj feature.

How do you propose it is fixed? It is arguable IMHO that the problem is 
not in g.proj. It will only interactively prompt if *partially complete* 
datum information is passed to it. If the GUI passes projection 
information that has been pre-processed so the datum part is OK, then it 
will not interactively prompt. This was discussed in an earlier thread.

Paul

P.S. A similar patch should probably also be applied to file_set.tcl.

P.P.S. The recent little usability improvements to gis_set.tcl (new 
location automatically selected etc.) are great! Well done.
-------------- next part --------------
Index: epsg_option.tcl

===================================================================

RCS file: /home/grass/grassrepository/grass6/lib/init/epsg_option.tcl,v

retrieving revision 1.7

diff -u -r1.7 epsg_option.tcl

--- epsg_option.tcl	24 Jan 2007 04:51:12 -0000	1.7

+++ epsg_option.tcl	30 Jan 2007 17:37:54 -0000

@@ -230,6 +230,7 @@

 	global env database

 	global location

 	global mapset

+	global mingw

 

 	#test for valid WIND file

 	if {[catch {exec g.region -p}] != 0} {

@@ -288,16 +289,13 @@

 		

 		

 		# create new location from EPSG code

-		catch {exec g.proj -c proj4=+init=epsg:$epsg_code location=$epsgLocation} errMsg

-		if {[lindex $::errorCode 0] eq "CHILDSTATUS"} {

-			DialogGen .wrnDlg [G_msg "WARNING: Error creating new location"] warning \

-			[format [G_msg "Error creating new location from EPSG code. \

-			g.proj returned following message:\n\n%s"] $errMsg] \

-			0 OK

+		if { $mingw == "1" } {

+			exec -- cmd.exe /c start g.proj -c proj4=+init=epsg:$epsg_code location=$epsgLocation

 		} else {

-		        set location $epsgLocation

-		        set mapset "PERMANENT"

+			exec -- $env(GISBASE)/etc/grass-xterm-wrapper -name xterm-grass -e $env(GISBASE)/etc/grass-run.sh g.proj -c proj4=+init=epsg:$epsg_code location=$epsgLocation

 		}

+		set location $epsgLocation

+		set mapset "PERMANENT"

 	

 		# restore previous .$GRASSRC

 		if {[file exists "$database/$tempdir/$GRASSRC"]} {

@@ -309,16 +307,13 @@

 		set env(GISRC) $curr_gisrc

 	} else {

 		# create new location from EPSG code

-		catch {exec g.proj -c proj4=+init=epsg:$epsg_code location=$epsgLocation} errMsg

-		if {[lindex $::errorCode 0] eq "CHILDSTATUS"} {

-			DialogGen .wrnDlg [G_msg "WARNING: Error creating new location"] warning \

-			[format [G_msg "Error creating new location from EPSG code. \

-			g.proj returned following message:\n\n%s"] $errMsg] \

-			0 OK

+		if { $mingw == "1" } {

+			exec -- cmd.exe /c start g.proj -c proj4=+init=epsg:$epsg_code location=$epsgLocation

 		} else {

-		        set location $epsgLocation

-		        set mapset "PERMANENT"

+			exec -- $env(GISBASE)/etc/grass-xterm-wrapper -name xterm-grass -e $env(GISBASE)/etc/grass-run.sh g.proj -c proj4=+init=epsg:$epsg_code location=$epsgLocation

 		}

+		set location $epsgLocation

+		set mapset "PERMANENT"

 	

 	}

 



More information about the grass-dev mailing list