[GRASS-user] r.out.gdal problem of grass6.3 in windows xp

Glynn Clements glynn at gclements.plus.com
Mon Jun 15 15:46:47 EDT 2009


maven apache wrote:

> When I use the commond r.out.gdal to export a raster map to tiff, I often
> got a black blank image, however when I use the commond r.out.tiff I can get
> a viewable tiff image.
> I want to know it is caused by my commond of something else?
> 
> ps:
> some commond run normally can not run in a programe.
> forexample:
> g.proj -c {georef=F:\anzhuang\Tomcat 5.5\1245076611265.tif}
> location=1245076611265location datumtrans=0
> I copy this command to the grass gui ,and it create a new location as I
> wanted. but in my programe from the log I get the following errors:
> 
> Sorry, <{georef> is not a valid parameter
> Sorry <5.5\1245076611265.tif}> is not a valid option

1. "georef=F:\anzhuang\Tomcat 5.5\1245076611265.tif" must be passed to
g.proj as a single argument. If you try to invoke g.proj via e.g. 
system(), the string will be split into multiple arguments due to
spaces.

2. The braces {...} are Tcl's quoting syntax; they prevent the string
from being split into multiple arguments within Tcl, but it won't work
for other languages.

For system(), try:

	system("g.proj -c \"georef=F:\\anzhuang\\Tomcat 5.5\\1245076611265.tif\"");

or:

	const char *filename = "F:\\anzhuang\\Tomcat 5.5\\1245076611265.tif";
	char buf[1024];

	sprintf(buf, "g.proj -c \"georef=%s\"", filename);
	system(buf);

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list