calling "coordinateFromRowCol" from a function in a jgrass script

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

calling "coordinateFromRowCol" from a function in a jgrass script

Emanuele Cordano
Dear all, 

I work with a Udig/Jgrass version provded at the latest MIGG 2010 for Mac. I work with OS X 6.3 Snow Leopard. I write the following functon in a JGrass Script and I want to extact the xy coordinates of a point of the region with the utility  "coordinateFromRowCol". Mac This utility works correctly if called directly from the script and out of the function. On the contrary, if I use the command "coordinateFromRowCol(mrow,COLS-CMA-1)" within the function, Jgrass does not find the command. I found out from the jgrass file "ConsoleHelper.groovy" that if I replace  "coordinateFromRowCol(mrow,COLS-CMA-1)" with "JGrassUtilities.rowColToCenterCoordinates(ACTIVEREGION, mrow,COLS-CMA-1)" , it works. Why does it happen?  

cheers
Emanuele

def CreateMaskMap() {


def null_value=log(-1)
def RMA=2
def CMA=2
def mrow=(int)(ROWS/2)

def origin=JGrassUtilities.rowColToCenterCoordinates(ACTIVEREGION, mrow, CMA)
def end_point=JGrassUtilities.rowColToCenterCoordinates(ACTIVEREGION, mrow,COLS-CMA-1)
// println origin.x 
// println origin.y
// def end_point=coordinateFromRowCol(mrow,COLS-CMA-1); THIS FUNCTION DOEAS NOT WORK WHTIN A FUNCTION 
def hillslope_length=100; //end_point.x-origin.x
println hillslope_length 
def newMap=CreateMapBasin(null_value,RMA,CMA,origin,hillslope_length)




}


_______________________________________________
JGrass-users mailing list
[hidden email]
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-users
Reply | Threaded
Open this post in threaded view
|

Re: calling "coordinateFromRowCol" from a function in a jgrass script

Andrea Antonello
Hi Emanuele,
sorry for delaying the answer, but we are busy getting out the latest
udig version on which the latest JGrass will run.
As soon as that comes out I will test the behaviour you describe,
which is actually king of strange.

Ciao,
Andrea

On Tue, May 18, 2010 at 10:36 AM, Emanuele Cordano <[hidden email]> wrote:

> Dear all,
> I work with a Udig/Jgrass version provded at the latest MIGG 2010 for Mac. I
> work with OS X 6.3 Snow Leopard. I write the following functon in a JGrass
> Script and I want to extact the xy coordinates of a point of the region with
> the utility  "coordinateFromRowCol". Mac This utility works correctly if
> called directly from the script and out of the function. On the contrary, if
> I use the command "coordinateFromRowCol(mrow,COLS-CMA-1)" within the
> function, Jgrass does not find the command. I found out from the jgrass file
> "ConsoleHelper.groovy" that if I replace
>  "coordinateFromRowCol(mrow,COLS-CMA-1)" with
> "JGrassUtilities.rowColToCenterCoordinates(ACTIVEREGION, mrow,COLS-CMA-1)" ,
> it works. Why does it happen?
> cheers
> Emanuele
> def CreateMaskMap() {
>
> def null_value=log(-1)
> def RMA=2
> def CMA=2
> def mrow=(int)(ROWS/2)
> def origin=JGrassUtilities.rowColToCenterCoordinates(ACTIVEREGION, mrow,
> CMA)
> def end_point=JGrassUtilities.rowColToCenterCoordinates(ACTIVEREGION,
> mrow,COLS-CMA-1)
> // println origin.x
> // println origin.y
> // def end_point=coordinateFromRowCol(mrow,COLS-CMA-1); THIS FUNCTION DOEAS
> NOT WORK WHTIN A FUNCTION
> def hillslope_length=100; //end_point.x-origin.x
> println hillslope_length
> def newMap=CreateMapBasin(null_value,RMA,CMA,origin,hillslope_length)
>
>
> }
>
> _______________________________________________
> JGrass-users mailing list
> [hidden email]
> https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-users
>
>
_______________________________________________
JGrass-users mailing list
[hidden email]
https://dev.fsc.bz.it/cgi-bin/mailman/listinfo/jgrass-users