1REM GMT EXAMPLE 32 2REM 3REM Purpose: Illustrate draping of an image over topography 4REM GMT modules: grdcut, grdedit, grdgradient, grdconvert, grdtrack, grdview 5REM GMT modules: coast, text, plot3d, makecpt 6REM DOS calls: echo, del 7REM Credits: Original by Stephan Eickschen 8REM 9gmt begin ex32 10 REM Here we get and convert the flag of Europe directly from the web through grdconvert using 11 REM GDAL support. We take into account the dimension of the flag (1000x667 pixels) 12 REM for a ratio of 3x2. 13 REM Because GDAL support will not be standard for most users, we have stored 14 REM the result, @euflag.nc in this directory. 15 16 set Rflag=-R3/9/50/54 17 REM gmt grdconvert \ 18 REM http://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Flag_of_Europe.svg/1000px-Flag_of_Europe.svg.png=gd \ 19 REM euflag.nc=ns 20 REM gmt grdedit euflag.nc -fg %Rflag% 21 22 REM Now get the topography for the same area, mask out the oceans and store it as topo_32.nc. 23 24 gmt grdcut @earth_relief_30s_p %Rflag% -Gtopo_32.nc=ns 25 gmt grdcut @earth_mask_30s_p %Rflag% -Gmask_32.nc=ns 26 gmt grdmath topo_32.nc mask_32.nc 0 GT 0 NAN MUL = topo_32.nc 27 28 REM The color map assigns "Reflex Blue" to the lower half of the 0-255 range and 29 REM "Yellow" to the upper half. 30 gmt makecpt -C0/51/153,255/204/0 -T0,127,255 -N 31 32 REM The next step is the plotting of the image. 33 REM We use gmt grdview to plot the topography, euflag.nc to give the color, and illum.nc to give 34 REM the shading. 35 set Rplot=%Rflag%/-10/790 36 gmt grdview topo_32.nc -JM13c %Rplot% -C -G@euflag.nc -I+a0/270+ne0.6 -Qc -JZ1c -p157.5/30 37 38 REM We now add borders. Because we have a 3-D plot, we want them to be plotted "at elevation". 39 REM So we write out the borders, pipe them through grdtrack and then plot them with plot3d. 40 gmt coast %Rflag% -Df -M -N1 | gmt grdtrack -Gtopo_32.nc -s+a | gmt plot3d %Rplot% -JZ -p -W1p,white 41 42 REM Finally, we add dots and names for three cities. 43 REM Again, gmt grdtrack is used to put the dots "at elevation". 44 echo 05:41:27 50:51:05 Maastricht > cities.txt 45 echo 04:21:00 50:51:00 Bruxelles >> cities.txt 46 echo 07:07:03 50:43:09 Bonn >> cities.txt 47 48 gmt grdtrack -Gtopo_32.nc cities.txt | gmt plot3d %Rplot% -JZ -p -Sc7p -W1p,white -Gred 49 gmt text -JZ -p -F+f12p,Helvetica-Bold,red+jRM -Dj0.1i/0 cities.txt 50 51 REM cleanup 52 del cities.txt 53gmt end show 54