How to increase resolution from gshhs?

12 vues (au cours des 30 derniers jours)
Jonathan Demmer
Jonathan Demmer le 16 Fév 2022
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')
  1 commentaire
Henrik Rohde Nordhus
Henrik Rohde Nordhus le 18 Oct 2022
I have the same problem. Did you figure it out?

Connectez-vous pour commenter.

Réponses (1)

Sai Teja G
Sai Teja G le 26 Juil 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!

Translated by