[winGRASS] Running batch queries in grass on windows from inside another application
Glynn Clements
glynn.clements at virgin.net
Thu May 22 16:21:38 EDT 2003
Buchan Milne wrote:
> My current project involves integrating some GIS functionality into a
> simulation that can only run on Windows, preferably using grass. It also
> involves pulling the coordinates to be queried from another system.
>
> At present, I have the coordinate queries and grass queries working
> under linux, however, I can't seem to get this to work on Windows with
> grass/cygwin, and it seems to be related to environment variables.
>
> I am developing my "glue code" with wxWindows, so I have code that is
> almost identical under Windows and Linux. Under linux, I can just build
> up a grass query (utilizing batch-grass to pass arguments that I want to
> become the environment variables), and execute it, and can get the
> results back in the form I want, and do the calculations necessary to
> get the data in the form the simulation needs.
>
> However, if I run the same program under Windows/cygwin, using a
> shell->batch ported version of batch-grass, variables set in the command
> prompt are not propagated to the grass programs (such as r.what).
> Exporting varaibles in a cygwin bash shell also does not seem to affect
> the grass query run from inside my application (which is started from
> inside a cygwin shell). Launching a shell (ie sh -c 'batchgrass db
> location query') also does not seem to work.
>
> So, does anyone know how I can achieve this on Windows? I am kind of
> missing a grass SDK ...
Some factors which may differ between Unix and Windows/Cygwin:
1. On Unix, children inherit the environment of their parent. This is
true within the Cygwin environment, but may not be true for native
Windows programs (when calling Cygwin -> Windows -> Cygwin, the
environment of the parent might not propagate through the Window
program).
2. Cygwin's /bin/sh is ash, so any bash extensions won't work. Cygwin
has bash, but you have to invoke it as "bash" not "sh".
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-windows
mailing list