Plotting fault traces on a map

Hi everyone!
I am using GMT 6.1.1 in order to plot some geological faults that I have on shp format. I manage to plot the DEM and the other data I have but not the fault traces.

I’m quite new to GMT, so I tried the solutions that I found in other topics in the forum but anything seems to work.

I attach my code without the part were I tried to plot the faults, my .shp and my DEM.

Thanks a lot to anyone who can help me
Cecilia

dem=“dem_GMT.grd”
output=“demo”
format=“png”
coord=‘15.0363/15.8347/40.4811/41.1491’
shp=‘Fault_Traces.shp’

gmt begin $output $format
gmt basemap -JM12 -R$coord -Ba0.5f0.1
gmt grdimage $dem -I -Cdem4
gmt makecpt -Cseis -T-75/10/1 -Z -I
awk ‘{print $1,$2}’ levelling_GMT.txt | gmt plot -R$coord -JM12 -Sc0.2 -Gwhite -C -Wthinner
gmt colorbar -C -Bxaf -By+l"dU (cm)" -Dx10.2c/8.5c+w4c/0.3c -F+gwhite@50
gmt end show

Link to the DEM
https://1drv.ms/u/s!AtrJN3XuxuDmgTP_7A62BdmRGFUK?e=xFz00b

levelling_GMT.txt (5.3 KB)

FAULT_TRACES_SHAPEFILE.zip (31.8 KB)

Hi @CeciM, welcome to the forum!

Shapefiles are not natively readable by GMT. Do you have GDAL installed on your system? If yes, you can use GDAL’s ogr2ogr to convert it into something GMT can read. Try

ogr2ogr -f OGR_GMT YourFileNameHere.gmt Fault_Traces_Bello_et_al_20xx.shp

and you should get something usable you can plot with plot. If you don’t have GDAL installed you can alternatively simply download this file :wink:

1 Like

Welcome @CeciM.

Could you share the commands that you use to plot the faults? Do you get any error message?

Hi @Esteban82, thanks for the interest!

These are the command I use to plot the faults, they don’t plot but they don’t give any error either

ogr2ogr -f "GMT" Fault_Traces_Bello_et_al_20xx.gmt  Fault_Traces_Bello_et_al_20xx.shp
gmt plot Fault_Traces_Bello_et_al_20xx.shp -R$coord -JM12 -S-0.2 -Gred -Wthin -V

Something I noticed is that the .gmt file looks odd but I don’t know if it’s the file or some kind of problem!
Thanks

You are welcome. I don’t see any error in the commands. Could you share the figure? Do you get any error message when you run the script?

this is the link to the image

I don’t get any error so I don’t understand where the problem is …

The odd thing I was referring to before is that when I open the .gmt file he coordinates are like that

205410.949800007 -147808.5099
205394.988200009 -147804.329500001
205299.824500002 -147779.405699998

They are odd because the point should be 4 digits before, but I don’t know if the .gmt fie is like that.

Furthermore, my QGis version doesn’t have the format GMT to save the shapefile with.

Yes, there is a “problem” in the file. The coordinates of the faults (planars, UTM?) are outside your map. Try to convert the file to geographic coordinates. I could be done with GMT but I am not sure how. Could you save the shp in geographic coordinates with QGis?