How to increase resolution from gshhs?

12 views (last 30 days)
Jonathan Demmer
Jonathan Demmer on 16 Feb 2022
Edited: Walter Roberson on 26 Jul 2024
Dear all,
The code below allowed me to download and plot the coastline of UK. However, I would like to have a better resolution. When i change, in line 13 of the code below, 'gshhs_c.b.gz' for 'gshhs_h.b.gz' an error appeared (see below). So, How can I have the best coastal resolution of the area I an interested in? please can soemone help me?
Error using checkfilename>validateFilename (line 157)
Function GUNZIP was unable to find file ''gshhs_h.b.gz''.
Error in checkfilename (line 49)
[fullfilename, fid] = validateFilename( ...
Error in gunzip>checkFilesURLInput (line 124)
[fullFileName, url] = checkfilename(inputFiles{1}, validExtensions, fcnName, ...
Error in gunzip (line 63)
[files, url, urlFilename] = checkFilesURLInput(files, {'gz'},'FILES',mfilename);
Error in test (line 13)
files = gunzip('gshhs_h.b.gz', workingFolder);
close all
clear all
clc
% assign the path to your working directory:
cd ('E:\SEEC\');
% add path to TelemacTolls functions (i.e. to read in telemac files into MATLAB):
addpath ('C:\Matlab_download\m_map1.4f\');
workingFolder = tempdir;
files = gunzip('gshhs_c.b.gz', workingFolder);
filename = files{1};
indexfile = gshhs(filename, 'createindex');
latlim = [50.45 56.31];
lonlim = [-8.1 -2.1];
S = gshhs(filename, latlim, lonlim);
delete(filename)
delete(indexfile)
levels = [S.Level];
L1 = S(levels == 1);
figure
axesm('mercator', 'MapLatLimit', latlim, 'MapLonLimit', lonlim)
gridm; mlabel; plabel
geoshow([L1.Lat], [L1.Lon], 'Color', 'blue')

Answers (1)

Sai Teja G
Sai Teja G on 26 Jul 2024
Hi Jonathan,
I noticed that you attempted to enhance the resolution of maps by using the 'gshhs_h.b.gz' file. However, you encountered an error because the 'gshhs_h.b.gz' file is not present in the mapdata folder on your MATLAB path. You can verify this by checking the folder.
To resolve this issue and run your code to increase the resolution, you can download the 'gshhs_h.b.gz' file from the provided link and add it to your MATLAB path. This will allow you to successfully execute your code and achieve the desired resolution enhancement.
Here is the link to the MATLAB Documentation:
Hope this resolves your query!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!