Just as a curisity, for a possible future mapserver application....
It is possible to execute a grass command from php?
If yes, how to pass the command? (it should open a grass session with all the var needed i guess!)
thanks, maxi
Just as a curisity, for a possible future mapserver application....
It is possible to execute a grass command from php?
If yes, how to pass the command? (it should open a grass session with
all the var needed i guess!)
Essentially, you need to set the appropriate environment variables
then run the program. See $GISBASE/etc/Init.sh for a full list of the
environment variables which are set for a normal interactive session,
but the important ones are GISBASE and GISRC.
For a server, you will need to either dynamically create a mapset for
each "session", or manage a pool of mapsets. The key point is that you
can't safely run multiple commands simultaneously in a single mapset.
On Fri, Oct 15, 2004 at 01:41:22AM +0100, Glynn Clements wrote:
Massimiliano Cannata wrote:
> Just as a curisity, for a possible future mapserver application....
> It is possible to execute a grass command from php?
> If yes, how to pass the command? (it should open a grass session with
> all the var needed i guess!)
Essentially, you need to set the appropriate environment variables
then run the program. See $GISBASE/etc/Init.sh for a full list of the
environment variables which are set for a normal interactive session,
but the important ones are GISBASE and GISRC.
For a server, you will need to either dynamically create a mapset for
each "session", or manage a pool of mapsets. The key point is that you
can't safely run multiple commands simultaneously in a single mapset.
On Fri, Oct 15, 2004 at 09:52:00AM +0200, Markus Neteler wrote:
On Fri, Oct 15, 2004 at 01:41:22AM +0100, Glynn Clements wrote:
>
> Massimiliano Cannata wrote:
>
> > Just as a curisity, for a possible future mapserver application....
> > It is possible to execute a grass command from php?
> > If yes, how to pass the command? (it should open a grass session with
> > all the var needed i guess!)
>
> Essentially, you need to set the appropriate environment variables
> then run the program. See $GISBASE/etc/Init.sh for a full list of the
> environment variables which are set for a normal interactive session,
> but the important ones are GISBASE and GISRC.
>
> For a server, you will need to either dynamically create a mapset for
> each "session", or manage a pool of mapsets. The key point is that you
> can't safely run multiple commands simultaneously in a single mapset.
That's pretty cool. I was able to do this on OSX using grass 5.7cvs quite easily by adapting your code. All I had to do was add 2 more environment settings to the php file (HOME=/Users/username and GIS_LOCK=$$) and make a copy of my .grassrc57 file in the web directory and add MONITOR: PNG to it. I also made a copy of the location I wanted to use and changed the ownership to www and changed the LOCATION_NAME in the .grassrc57 file to match that new location. Unfortunately, I can't share my sample because I don't have grass installed on my Web server - I have to run it locally - but you can put together a pretty neat map server with lots of functionality in a very short time.
Mark
-----
Have fun or die trying - but try not to actually die. http://www.AboveCalifornia.com
Got Mac OS X? Get the AboveCalifornia Sherlock Channel:
sherlock://www.AboveCalifornia.com/sherlock/SherlockChannel.xml?action=add
Wanna frag? Add the ..::LVL Sherlock Channel and get the newest Quake3 maps:
sherlock://www.AboveCalifornia.com/sherlock/LVL/SherlockChannel.xml?action=add
On Oct 15, 2004, at 9:21 AM, Markus Neteler wrote:
I have made it a quick-and-dirty web page now which generates a
GRASS raster/vector map on the fly: