Skip to content

Commit e6472c2

Browse files
committed
Update docs
1 parent 905eeeb commit e6472c2

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

doc/rst/source/psconvert.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,9 @@ Optional Arguments
226226
by the Ghostscript. In that case you really must use **-B** or use a
227227
slightly off-white color.
228228

229-
Together with **-V** it prints on screen the gdal_translate
230-
(gdal_translate is a command line tool from the GDAL package)
229+
Together with **-V** it prints on screen the :doc:`grdgdal`
231230
command that reads the raster + world file and creates a true
232-
geotiff file. Append **+g** to do a system call to gdal_translate
233-
and create a geoTIFF image right away. The output file will have a
234-
.tiff extension.
231+
geotiff file. The output file will have a .tiff extension.
235232

236233
The world file naming follows the convention of jamming a 'w' in the
237234
file extension. So, if output is tif **-Tt** the world file is a

src/gmt_gdalcall.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ GMT_LOCAL char ** breakMe(struct GMT_CTRL *GMT, char *in) {
139139
p[k] = ' '; /* Replace spaces and tabs masked above */
140140
}
141141
for (i = o = 0; p[i]; i++)
142-
if (p[i] != '\"') p[o++] = p[i]; /* Ignore any double quotes */
142+
if (p[i] != '\'') p[o++] = p[i]; /* Ignore any single quotes */
143143
p[o] = '\0';
144144
args[n_args++] = strdup(p);
145145

src/psconvert.c

+10-16
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)