Using shapefiles in GMT

Good morning everyone.

I’m trying to plot a map of East Africa showing the fault lines using shapefiles. I have a file named gem_active_faults.shp, but when I ran my GMT code, I received the following output (shown below).

Could someone please help me figure out what’s causing this issue?

I’m currently using GMT version 6.1.0.

→ PCIDSK' -> netCDF’
→ PDS4' -> VICAR’
→ PDF' -> MBTiles’
→ BAG' -> EEDA’
→ OGCAPI' -> ESRI Shapefile’
→ MapInfo File' -> UK .NTF’
→ OGR_SDTS' -> S57’
→ DGN' -> OGR_VRT’
→ REC' -> Memory’
→ CSV' -> GML’
→ GPX' -> KML’
→ GeoJSON' -> GeoJSONSeq’
→ ESRIJSON' -> TopoJSON’
→ OGR_GMT' -> GPKG’
→ SQLite' -> WAsP’
→ OpenFileGDB' -> DXF’
→ CAD' -> FlatGeobuf’
→ Geoconcept' -> GeoRSS’
→ GPSTrackMaker' -> VFK’
→ PGDUMP' -> OSM’
→ GPSBabel' -> OGR_PDS’
→ WFS' -> OAPIF’
→ EDIGEO' -> SVG’
→ CouchDB' -> Cloudant’
→ Idrisi' -> ARCGEN’
→ Elasticsearch' -> Carto’
→ AmigoCloud' -> SXF’
→ Selafin' -> JML’
→ PLSCENES' -> CSW’
→ VDV' -> MVT’
→ NGW' -> MapML’
→ TIGER' -> AVCBin’
→ AVCE00' -> HTTP’
plot [ERROR]: System call [ogr2ogr -mapFieldType Integer64=Integer -skipfailures -f “OGR_GMT” “/tmp/gmt_ogr_3727.gmt” “gem_active_faults.shp”] FAILED with error 256.
plot [ERROR]: Cannot open file gem_active_faults.shp
parker.sh: line 53: EOF: command not found
gmt [ERROR]: Not available in classic mode

The code
gmt begin east_africa_faults_map pdf

gmt set MAP_FRAME_TYPE plain

gmt set FONT_LABEL 15p

gmt makecpt -Cjet -T-4.0/4.0

gmt basemap -R28/45/-12/15 -JM15c -Baf -BWSen+t"East Africa Faults"

ogr2ogr -f “GMT” faults.gmt gem_active_faults.shp

gmt plot gem_active_faults.shp -W0.8p,black

gmt coast -W0.25p -N1/0.5p,gray -A500 –Df

EOF

gmt end show

gmt end

looking forward for assistance

What happens if you do:

ogr2ogr -F ‘OGR_GMT’ test.gmt gem_active_faults.shp

This is not a GMT.jl question. Is it so difficult to respect the categories?

Hey @usifohsaturday,

I think you use the data available at gem-global-active-faults/shapefile at master · cossatot/gem-global-active-faults · GitHub. I just tried this, and the conversion seems to work for me.

Please keep in mind that a shapefile is not one single file, but there are several files with different extensions that are all important and should be placed in one folder. If I only have the file with the extension *.shp I get an error that has similarity with the one you posted.

Besides this

  • You should use the converted file faults.gmt for plotting.
  • The usage of EOF here is not clear to me.
  • After using gmt end show, calling gmt end is not needed.