Plotting line fronts using plot3d

Hi there,

I’m plotting a perspective view of some topography and would like to add shapefiles of my mapping (folds axes and faults). I’m using the -Sf option in plot3d to plot line decorations.

Unfortunately, while the lines plot in the right place the decorations do not. I believe this is because the line is plotting at the correct Z value, but the decorations are not (I’ve checked this by plotting the view from directly above). However I don’t see anything in the docs about differences in height between line and decoration.

A minor point I’ve managed to bodge is that the coast doesn’t plot at the correct place unless I offset the height using -Ya0.5c, again because it is plotting at wrong height. I believe this may be to do with the Caspian Sea level being below the geoid sea level due to it being an enclosed basin, but not sure, and any help here would be great also.

All necessary inputs should be here: az_perspective_map - Google Drive

#!/bin/bash

# Define the input and output file paths
input_dem="dem.tif"        # Path to your input DEM TIFF file
output_image="perspective_map"  # Path to the output image file

# Set the region and projection parameters
region="-R47.5/53.3/38.1/41.5"      # Change to your desired region (min lon/max lon/min lat/max lat)
projection="-JZ2c"    # Perspective view with 2c Z-axis height 
viewpoint="-p170/30"             # Viewing angle (azimuth/elevation) 170° azimuth, 30° elevation
dreg="-R47.5/53.3/38.1/41.5/-2000/5000"

gmt begin $output_image
    # Generate hillshade for realistic topography lighting
    gmt grdgradient dem.grd -A45 -Nt0.5 -Ghillshade.nc

    # convert shapefiles
    ogr2ogr -t_srs "EPSG:4326" -of "GMT" faults_for_perspective.gmt faults_for_perspective.shp
    ogr2ogr -of "GMT" faults_for_perspective_uncertain.gmt faults_for_perspective_uncertain.shp
    ogr2ogr -of "GMT" folds_for_perspective.gmt folds_for_perspective.shp

    # Plot the DEM with perspective view and hillshading
    gmt makecpt -Cdavos  -T-1500/1000 # -Ic #reverse
    echo "##### plot dem"
    gmt grdview dem.grd  $dreg -JM20c $projection $viewpoint  -Ihillshade.nc -Qi300 -N-6000+glightgray -C #-Ginsar.grd
    gmt makecpt -Cbatlow  -T0/10 #insar_nonan_clipped_nodata.gmt
    # echo "##### plot insar overlay"
    # gmt grdview dem.grd $dreg $projection $viewpoint  -Qc300 -Ihillshade.nc  -C -N-6000 -Ginsar_nonan_clipped_nodata_nan.gmt 
    echo "##### plot coast"
    gmt coast $region $viewpoint -Ya0.5c -W 
    echo "##### plot faults"

    cat faults_for_perspective.gmt | gmt grdtrack -Gdem.grd -s+a > faults_for_perspective_3d.gmt
    cat faults_for_perspective_uncertain.gmt | gmt grdtrack -Gdem.grd -s+a > faults_for_perspective_uncertain_3d.gmt
    cat folds_for_perspective.gmt | gmt grdtrack -Gdem.grd -s+a > folds_for_perspective_3d.gmt

    gmt plot3d faults_for_perspective_3d.gmt $dreg  $viewpoint  -JZ -W1p,red -Sf5c/1c+l+s45+o2.25c
    gmt plot3d faults_for_perspective_uncertain_3d.gmt $dreg  $viewpoint  -JZ -W1p,red,-
    gmt plot3d folds_for_perspective_3d.gmt $dreg  $viewpoint  -JZ -W1p,black -Sf1c/0.3c+l+t 
    echo "##### plot Baku"

    echo 49.867092 40.409264 Baku | gmt grdtrack -Gdem.grd -s+a | gmt plot3d  $dreg $viewpoint -JZ2c -Sc0.1c -Gred

gmt end show