# Plotting fault traces on a map

**URL:** <https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526>\
**Category:** Q&A\
**Tags:** gmt\
**Created:** [April 2, 2021, 9:55am UTC](https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526 "2021-04-02T09:55:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CeciM](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@CeciM](https://forum.generic-mapping-tools.org/u/CeciM)\
**Post date:** [April 2, 2021, 9:55am UTC](https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526/1 "2021-04-02T09:55:34Z")

</div>

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

> **[Microsoft OneDrive](https://onedrive.live.com/?id=E6E0C6EE7537C9DA%21179&resid=E6E0C6EE7537C9DA%21179&e=xFz00b&migratedtospo=true&redeem=aHR0cHM6Ly8xZHJ2Lm1zL3UvcyFBdHJKTjNYdXh1RG1nVFBfN0E2MkJkbVJHRlVLP2U9eEZ6MDBi&cid=e6e0c6ee7537c9da)**

[levelling\_GMT.txt](https://forum.generic-mapping-tools.org/uploads/short-url/bCiOrFUmLL4vw1QlnPFcM5wb1Cy.txt) (5.3 KB)

[FAULT\_TRACES\_SHAPEFILE.zip](https://forum.generic-mapping-tools.org/uploads/short-url/bNi7wWGqK5vLpABBgfzVPkA7HM8.zip) (31.8 KB)

---

<div class="post-metadata">

**Author:** ![KristofKoch](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/kristofkoch/32/314_2.png) [@KristofKoch](https://forum.generic-mapping-tools.org/u/KristofKoch)\
**Post date:** [April 2, 2021, 12:54pm UTC](https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526/2 "2021-04-02T12:54:35Z")

</div>

Hi @CeciM, welcome to the forum!

Shapefiles are not natively readable by GMT. Do you have [GDAL](https://gdal.org) 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](https://forum.generic-mapping-tools.org/uploads/short-url/e6kgrGBAj5inVdcJ9TgAg74At5o.zip) 😉

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [April 2, 2021, 2:47pm UTC](https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526/3 "2021-04-02T14:47:15Z")

</div>

Welcome @CeciM.

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

---

<div class="post-metadata">

**Author:** ![CeciM](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@CeciM](https://forum.generic-mapping-tools.org/u/CeciM)\
**Post date:** [April 6, 2021, 7:43am UTC](https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526/4 "2021-04-06T07:43:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [April 6, 2021, 12:53pm UTC](https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526/5 "2021-04-06T12:53:14Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![CeciM](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@CeciM](https://forum.generic-mapping-tools.org/u/CeciM)\
**Post date:** [April 6, 2021, 1:02pm UTC](https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526/6 "2021-04-06T13:02:42Z")

</div>

this is the link to the [image](https://1drv.ms/u/s!AtrJN3XuxuDmgTT9Q-PfRQ-tOrm2?e=92W0wk)

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.

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [April 6, 2021, 1:09pm UTC](https://forum.generic-mapping-tools.org/t/plotting-fault-traces-on-a-map/1526/7 "2021-04-06T13:09:34Z")

</div>

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?
