@@ -720,7 +720,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
720720 GMT_Usage (API , -2 , "Note: The EPS format can be combined with any of the other formats. "
721721 "For example, -Tef creates both an EPS and PDF file." );
722722 GMT_Option (API , "V" );
723- GMT_Usage (API , -2 , "Note: Shows the gdal_translate command, in case you want to use this program "
723+ GMT_Usage (API , -2 , "Note: Shows the grdgdal command, in case you want to use this program "
724724 "to create a geoTIFF file." );
725725 GMT_Usage (API , 1 , "\n-W[+a<mode>[<alt]][+c][+f<minfade>/<maxfade>][+g][+k][+l<lodmin>/<lodmax>][+n<name>][+o<folder>][+t<title>][+u<URL>]" );
726726 GMT_Usage (API , -2 , "Write an ESRI type world file suitable to make .tif files "
@@ -735,8 +735,7 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
735735 "computations. The world file naming follows the convention of jamming "
736736 "a 'w' in the file extension. So, if the output is tif (-Tt) the world "
737737 "file is a .tfw, for jpeg a .jgw, and so on. A few modifiers are available:" );
738- GMT_Usage (API , 3 , "+g Do a system call to gdal_translate and produce a true "
739- "eoTIFF image right away. The output file will have the extension "
738+ GMT_Usage (API , 3 , "+g Produce a true geoTIFF image right away. The output file will have the extension "
740739 ".tiff. See the man page for other 'gotchas'. Automatically sets -A -P." );
741740 GMT_Usage (API , 3 , "+k Create a minimalist KML file that allows loading the "
742741 "image in Google Earth. Note that for this option the image must be "
@@ -1596,7 +1595,7 @@ EXTERN_MSC int GMT_psconvert (void *V_API, int mode, void *args) {
15961595 char ps_file [PATH_MAX ] = "" , no_U_file [PATH_MAX ] = "" , clean_PS_file [PATH_MAX ] = "" , tmp_file [PATH_MAX ] = "" ,
15971596 out_file [PATH_MAX ] = "" , BB_file [PATH_MAX ] = "" , resolution [GMT_LEN128 ] = "" , jpeg_device [GMT_LEN16 ] = {"" };
15981597 char * line = NULL , c1 [20 ] = {"" }, c2 [20 ] = {"" }, c3 [20 ] = {"" }, c4 [20 ] = {"" }, GSstring [GMT_LEN64 ] = {"" },
1599- cmd [GMT_BUFSIZ ] = {"" }, proj4_name [20 ] = {"" }, * quiet = NULL ;
1598+ cmd [GMT_BUFSIZ ] = {"" }, proj4_name [20 ] = {"" };
16001599 char * gs_BB = NULL , * proj4_cmd = NULL ;
16011600 char * device [N_GS_DEVICES ] = {"" , "pdfwrite" , "svg" , "jpeg" , "png16m" , "ppmraw" , "tiff24nc" , "bmp16m" , "pngalpha" ,
16021601 "jpeggray" , "pnggray" , "tiffgray" , "bmpgray" };
@@ -2767,19 +2766,14 @@ EXTERN_MSC int GMT_psconvert (void *V_API, int mode, void *args) {
27672766 world_file [pos_ext ] = '\0' ;
27682767 strcat (world_file , ".tiff" );
27692768
2770- if (GMT -> current .setting .verbose < GMT_MSG_WARNING ) /* Shut up the gdal_translate (low level) verbosity */
2771- quiet = " -quiet" ;
2772- else
2773- quiet = "" ;
2774-
2775- sprintf (cmd , "gdal_translate -mo TIFFTAG_XRESOLUTION=%g -mo TIFFTAG_YRESOLUTION=%g -a_srs %c%s%c "
2776- "-co COMPRESS=LZW -co TILED=YES %s %c%s%c %c%s%c" ,
2777- Ctrl -> E .dpi , Ctrl -> E .dpi , quote , proj4_cmd , quote , quiet , quote , out_file , quote , quote , world_file , quote );
2769+ sprintf (cmd , "%c%s%c -Atranslate -M -G%c%s%c -F\"-mo TIFFTAG_XRESOLUTION=%g -mo TIFFTAG_YRESOLUTION=%g -a_srs %c%s%c "
2770+ "-co COMPRESS=LZW -co TILED=YES\"" ,
2771+ quote , out_file , quote , quote , world_file , quote , Ctrl -> E .dpi , Ctrl -> E .dpi , quote , proj4_cmd , quote );
27782772 gmt_M_str_free (proj4_cmd );
2779- sys_retval = system ( cmd ); /* Execute the gdal_translate command */
2780- GMT_Report ( API , GMT_MSG_INFORMATION , "The gdal_translate command: \n%s\n" , cmd );
2781- if (sys_retval ) {
2782- GMT_Report (API , GMT_MSG_ERROR , "System call [%s] returned error %d.\n" , cmd , sys_retval );
2773+ GMT_Report ( API , GMT_MSG_INFORMATION , "The grdgdal command: \n%s\n" , cmd );
2774+
2775+ if (GMT_Call_Module ( API , "grdgdal" , GMT_MODULE_CMD , cmd ) != GMT_OK ) { /* Failed to do the conversion */
2776+ GMT_Report (API , GMT_MSG_ERROR , "Call to grdgdal [%s] returned error %d.\n" , cmd , sys_retval );
27832777 Return (GMT_RUNTIME_ERROR );
27842778 }
27852779 if (!Ctrl -> T .active ) /* Get rid of the intermediate JPG file if -T was not set */
0 commit comments