Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/gmt_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -5217,8 +5217,9 @@ FILE * gmt_fopen (struct GMT_CTRL *GMT, const char *filename, const char *mode)
if (!fd) { /* No, was not a netCDF file */
if ((c = gmt_getdatapath (GMT, &filename[first], path, R_OK)) != NULL) { /* Got the file path */
char *ext = gmt_get_ext (c); /* Get pointer to extension (or NULL if no extension) */
if (ext && mode[0] == 'r' && !strncmp (ext, "shp", 3U)) { /* Got a shapefile for reading */
/* We will do a system call to ogr2ogr in order to read the shapefile */
if (ext && mode[0] == 'r' && (!strncasecmp (ext, "shp", 3U) || !strncasecmp(ext, "geojson", 7U) || !strncasecmp(ext, "json", 4U) )) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also changed strncmp to strncasecmp so that extensions like SHP are also supported.

/* Got a shapefile or geojson file for reading */
/* We will do a system call to ogr2ogr to convert it to OGR_GMT format */
char cmd[GMT_BUFSIZ+GMT_LEN256] = {""};
int error = 0;
if (GMT->parent->tmp_dir) /* Make unique file in temp dir */
Expand Down
Loading