Hi:
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
At first I think it is the space in the path,but in the gui grass I found the space is no effect.
maven apache wrote:
Hi:
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?
Can you please give some more information:
- r.info on the raster you want to export
- g.region -p
- the exact r.out.gdal command
- the spatial data viewer you use to display the exported GeoTIFF
Without all this information it is impossible to tell why the GeoTIFF
created by r.out.gdal appears blank.
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@gclements.plus.com>
Thank you !
I have consider the space problem,and I try to avoid it:
String filePath=file.getAbsolutePath(); // F:\anzhuang\Tomcat 5.5.…tif
String creatLocation=System.currentTimeMillis()+“location”;
filePath=filePath.replace(“\”, “\\”); //no matter I add this line or not the filepath is splitted ever
String cmd=“g.proj -c georef=”+filePath+" location=“+creatLocation+” datumtrans=0";
2009/6/16 Glynn Clements <glynn@gclements.plus.com>
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
-
“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.
-
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@gclements.plus.com>
maven apache wrote:
I have consider the space problem,and I try to avoid it:
String filePath=file.getAbsolutePath(); // F:\anzhuang\Tomcat 5.5\....tif
String creatLocation=System.currentTimeMillis()+"location";
filePath=filePath.replace("\\", "\\\\"); //no matter I add this line or not the filepath is splitted ever
String cmd="g.proj -c georef="+filePath+" location="+creatLocation+" datumtrans=0";
You aren't quoting the path. Try:
String cmd="g.proj -c \"georef="+filePath+"\" location="+creatLocation+" datumtrans=0";
--
Glynn Clements <glynn@gclements.plus.com>
Thanks,it works now!~
2009/6/16 Glynn Clements <glynn@gclements.plus.com>
maven apache wrote:
I have consider the space problem,and I try to avoid it:
String filePath=file.getAbsolutePath(); // F:\anzhuang\Tomcat 5.5.…tif
String creatLocation=System.currentTimeMillis()+“location”;
filePath=filePath.replace(“\”, “\\”); //no matter I add this line or not the filepath is splitted ever
String cmd=“g.proj -c georef=”+filePath+" location=“+creatLocation+” datumtrans=0";
You aren’t quoting the path. Try:
String cmd=“g.proj -c "georef=”+filePath+“" location=”+creatLocation+" datumtrans=0";
–
Glynn Clements <glynn@gclements.plus.com>
maven apache wrote:
Hi:
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?
Hi Maven Apache:
I had the 6.3 version of GRASS on Win XP installed previously, and I also couldn't get a proper tiff file exported using r.out.gdal.
Today I upgraded, using the OSGEO4W installer to the 6.4 version of GRASS (gdal 1.5.4) and retried with your kk.tif which you sent yesterday. And both r.out.tiff as well as r.out.gdal worked as expected - i.e like on linux ;-).
Would you like to try that upgrade and report back if it solves the export problem?
Regards
--
Micha
Thanksf Micha Silver,I will have a try.
2009/6/16 Micha Silver <micha@arava.co.il>
maven apache wrote:
Hi:
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?
Hi Maven Apache:
I had the 6.3 version of GRASS on Win XP installed previously, and I also couldn’t get a proper tiff file exported using r.out.gdal.
Today I upgraded, using the OSGEO4W installer to the 6.4 version of GRASS (gdal 1.5.4) and retried with your kk.tif which you sent yesterday. And both r.out.tiff as well as r.out.gdal worked as expected - i.e like on linux ;-).
Would you like to try that upgrade and report back if it solves the export problem?
Regards
Micha