Hi:
I have post this problem before, I want to run grass in command line model so I can call them in java at that time,however it often cause some unexpeced errors.
So today I change to Ubuntu, and I install grass use sudo apt-get install grass.
Now I also want to call grass in my java code but in the Ubuntu platform, I want to know which environment variables are needed, so I did some tests.
First I run grass in text model in the ternimal by " grass -text",
and I chose the location and mapset,it works, then I use command “set > /home/kk/var” to get all the environment variablse using by grass ,then I open a new ternimal to get the normal env vars by " set > /home/kk/varn" . Then I compare the two files and tried to find the differences. I found that there are more variables in the varn rather than var (shown below):
On Tue, Mar 2, 2010 at 12:05 PM, maven apache <apachemaven0@gmail.com> wrote:
Hi:
I have post this problem before, I want to run grass in command line model
so I can call them in java at that time,however it often cause some
unexpeced errors.
So today I change to Ubuntu, and I install grass use sudo apt-get install
grass.
Now I also want to call grass in my java code but in the Ubuntu platform, I
want to know which environment variables are needed, so I did some tests.
First I run grass in text model in the ternimal by " grass -text",
and I chose the location and mapset,it works, then I use command "set >
/home/kk/var" to get all the environment variablse using by grass ,then I
open a new ternimal to get the normal env vars by " set > /home/kk/varn" .
Then I compare the two files and tried to find the differences. I found
that there are more variables in the varn rather than var (shown below):
-----------
GISBASE=/usr/lib/grass64
GISRC=/tmp/grass6-kk-9581/gisrc
GIS_LOCK=9581
GRASS_GNUPLOT='gnuplot -persist'
GRASS_HTML_BROWSER=x-www-browser
GRASS_LD_LIBRARY_PATH=/usr/lib/grass64/lib
GRASS_PAGER=pager
GRASS_PERL=/usr/bin/perl
GRASS_PROJSHARE=/usr/share/proj
GRASS_PYTHON=python
GRASS_SH=/bin/sh
GRASS_TCLSH=tclsh
GRASS_VERSION=6.4.0RC5
GRASS_WISH=wish
-----------
So I want to know if these vars are enough?
I have no idea. But it is way easier to use GRASS in batch mode:
Hi:
I have post this problem before, I want to run grass in command line model
so I can call them in java at that time,however it often cause some
unexpeced errors.
So today I change to Ubuntu, and I install grass use sudo apt-get install
grass.
Now I also want to call grass in my java code but in the Ubuntu platform, I
want to know which environment variables are needed, so I did some tests.
First I run grass in text model in the ternimal by " grass -text",
and I chose the location and mapset,it works, then I use command “set >
/home/kk/var” to get all the environment variablse using by grass ,then I
open a new ternimal to get the normal env vars by " set > /home/kk/varn" .
Then I compare the two files and tried to find the differences. I found
that there are more variables in the varn rather than var (shown below):
I have post this problem before, I want to run grass in command line model
so I can call them in java at that time,however it often cause some
unexpeced errors.
So today I change to Ubuntu, and I install grass use sudo apt-get install
grass.
Now I also want to call grass in my java code but in the Ubuntu platform, I
want to know which environment variables are needed, so I did some tests.
First I run grass in text model in the ternimal by " grass -text",
and I chose the location and mapset,it works, then I use command "set >
/home/kk/var" to get all the environment variablse using by grass ,then I
open a new ternimal to get the normal env vars by " set > /home/kk/varn" .
Then I compare the two files and tried to find the differences. I found
that there are more variables in the varn rather than var (shown below):
-----------
GISBASE=/usr/lib/grass64
GISRC=/tmp/grass6-kk-9581/gisrc
GIS_LOCK=9581
GRASS_GNUPLOT='gnuplot -persist'
GRASS_HTML_BROWSER=x-www-browser
GRASS_LD_LIBRARY_PATH=/usr/lib/grass64/lib
GRASS_PAGER=pager
GRASS_PERL=/usr/bin/perl
GRASS_PROJSHARE=/usr/share/proj
GRASS_PYTHON=python
GRASS_SH=/bin/sh
GRASS_TCLSH=tclsh
GRASS_VERSION=6.4.0RC5
GRASS_WISH=wish
-----------
So I want to know if these vars are enough?
[PYTHONPATH is only relevant if running Python scripts which use the
grass.script modules.]
Many of the above are unnecessary.
GRASS_TCLSH and GRASS_PERL aren't used. GRASS_SH is only used on
Windows. GRASS_PROJSHARE defaults to /usr/share/proj if not set.
GRASS_WISH, GRASS_PYTHON, GRASS_HTML_BROWSER and GRASS_LD_LIBRARY_PATH
are only relevant for interactive use. GRASS_GNUPLOT is only used by
i.spectral.
Although it shouldn't matter, I suggest GRASS_PAGER=cat and
GRASS_MESSAGE_FORMAT=silent.
If you need to use any display commands, you also need to set
GRASS_RENDER_IMMEDIATE=TRUE, and may want to use some of the variables
documented in the "pngdriver" manual page to control the output.
... and if *any* user editable inputs will be visible from the web side of
the app make 100% sure that you have bounds checked and sanitized every
single one of them. Stripping all punctuation and limiting the string length
before passing as a module option is a good first step.
I've no idea about java but with unix power tools pipe it through
`cut -b 255 | sed -e 's/[^a-zA-Z0-9_]//g'`
to only keep the first 255 chars, and only keep a-z, A-Z, 0-9, and the
underscore "_".
there are chances for buffer overflows and unquoted shell script variables
all over the place.
Hi:
I found that the grassBatchJob is so excited that I like it,however I wonder that each time a user who want to run grass in my web application have to write a .sh file and then call the grass with the BATCH_JOB may cause low effectivity? after all, this is realated the IO operation, isn’t it?
… and if any user editable inputs will be visible from the web side of
the app make 100% sure that you have bounds checked and sanitized every
single one of them. Stripping all punctuation and limiting the string length
before passing as a module option is a good first step.
I’ve no idea about java but with unix power tools pipe it through cut -b 255 | sed -e 's/[^a-zA-Z0-9_]//g'
to only keep the first 255 chars, and only keep a-z, A-Z, 0-9, and the
underscore “_”.
there are chances for buffer overflows and unquoted shell script variables
all over the place.
Hi:
I found that the grassBatchJob is so excited that I like it,however I wonder that each time a user who want to run grass in my web application have to write a .sh file and then call the grass with the BATCH_JOB may cause low effectivity? after all, this is realated the IO operation, isn’t it?
… and if any user editable inputs will be visible from the web side of
the app make 100% sure that you have bounds checked and sanitized every
single one of them. Stripping all punctuation and limiting the string length
before passing as a module option is a good first step.
I’ve no idea about java but with unix power tools pipe it through cut -b 255 | sed -e 's/[^a-zA-Z0-9_]//g'
to only keep the first 255 chars, and only keep a-z, A-Z, 0-9, and the
underscore “_”.
there are chances for buffer overflows and unquoted shell script variables
all over the place.