Dear all,
I know the similar issue in another question..
But, my question is a little bit different.
I would like to map the fault as well, but I followed this document to open a shape file in the GMT.
What’s the problem in my GMT script?
I made my GMT script below:
#!/changwan/bin/env bash
region="-R127/130/34/38"
#projection
#input_path="/home/changwan/GMT/Fault_reference_line/Fault/YSF_reference line.shp"
gmt begin YFS png
ogr2ogr -f OGR_GMT test_shape.gmt 'YSF_reference line'.shp
gmt convert test_shape.gmt -bo2f > test_shape.bf2
gmt select test_shape.bf2 -bi2f -bo2f $region > test_shape_final.bf2
gmt coast $region -Gdarkseagreen2 -Scornflowerblue
# gmt plot test_shape_final.bf2 -bi2f -Wthick,red -Gred
# gmt psxy 'YSF_reference line.shp' -bi2f -Wthick,red -Gred
# gmt plot test_shape.gmt -Wthick,red -Gred
gmt basemap --MAP_FRAME_TYPE=fancy -Ba2f1g1 -BWSne+t"Yangsan Fault System"
gmt end show
And I got this error:
ERROR 4: Unable to open YSF_reference line.shx or YSF_reference line.SHX. Set SHAPE_RESTORE_SHX config option to YES to restore or create it.
FAILURE:
Unable to open datasource `YSF_reference line.shp' with the following drivers.
-> `PCIDSK'
-> `netCDF'
-> `PDS4'
-> `JP2OpenJPEG'
-> `JPEG2000'
-> `PDF'
-> `MBTiles'
-> `EEDA'
-> `ESRI Shapefile'
-> `MapInfo File'
-> `UK .NTF'
-> `OGR_SDTS'
-> `S57'
-> `DGN'
-> `OGR_VRT'
-> `REC'
-> `Memory'
-> `BNA'
-> `CSV'
-> `NAS'
-> `GML'
-> `GPX'
-> `LIBKML'
-> `KML'
-> `GeoJSON'
-> `GeoJSONSeq'
-> `ESRIJSON'
-> `TopoJSON'
-> `Interlis 1'
-> `Interlis 2'
-> `OGR_GMT'
-> `GPKG'
-> `SQLite'
-> `OGR_DODS'
-> `ODBC'
-> `WAsP'
-> `PGeo'
-> `MSSQLSpatial'
-> `OGR_OGDI'
-> `PostgreSQL'
-> `MySQL'
-> `OpenFileGDB'
-> `XPlane'
-> `DXF'
-> `CAD'
-> `Geoconcept'
-> `GeoRSS'
-> `GPSTrackMaker'
-> `VFK'
-> `PGDUMP'
-> `OSM'
-> `GPSBabel'
-> `SUA'
-> `OpenAir'
-> `OGR_PDS'
-> `WFS'
-> `WFS3'
-> `HTF'
-> `AeronavFAA'
-> `Geomedia'
-> `EDIGEO'
-> `GFT'
-> `SVG'
-> `CouchDB'
-> `Cloudant'
-> `Idrisi'
-> `ARCGEN'
-> `SEGUKOOA'
-> `SEGY'
-> `XLS'
-> `ODS'
-> `XLSX'
-> `ElasticSearch'
-> `Walk'
-> `Carto'
-> `AmigoCloud'
-> `SXF'
-> `Selafin'
-> `JML'
-> `PLSCENES'
-> `CSW'
-> `VDV'
-> `GMLAS'
-> `MVT'
-> `TIGER'
-> `AVCBin'
-> `AVCE00'
-> `NGW'
-> `HTTP'
plot [WARNING]: File test_shape_final.bf2 is empty!
like the previous question.
Then, I open the GMT file. test_shape.gmt. I can see this below:
I think ogr2ogr is working very well because we can see coordinate and other information.
I tried plot and psxy module to open shape file without using ogr2gor, but I failed, and only the cursor blinked without any map…
The last warning said the file is empty, and then the problem is gmt select module?
What’s the problem in my GMT script?
Regards,
Changwan