MATLAB Answers

How to plot boundaries region contours of countries in worldmap?

109 views (last 30 days)
Emrys on 1 Mar 2018
Commented: Emrys on 2 Mar 2018
Hi guys, i have to plot with worldmap , all the region of the Italian country. Is there any way of doing this?


Sign in to comment.

Accepted Answer

Paul Shoemaker
Paul Shoemaker on 1 Mar 2018

I've used the website to download country data (no affiliation to organization). You can select download, pick "Italy" from the download list, and select the format you want to use. Shapefile, among some of the others, are directly supported in Matlab.

Good luck!

Paul Shoemaker


Paul Shoemaker
Paul Shoemaker on 1 Mar 2018
As a follow-up, you can download and plot Italy using the below snippet of code.
countryCode = 'ITA'; % Country code for Italy
baseURL = ''; % Base format for download (found direct-link using Google Chrome after downloading a sample file
downloadURL = strrep(baseURL,'???',countryCode); % Country code for Italy is ITA, substitute into URL
destinationFile = ''; % Name of temporary file to download (trash after using)
urlwrite(downloadURL,destinationFile); % Download the zip file for country
unzip(destinationFile,['.' filesep 'shapeFileFolder']); % Unzip contents
delete(destinationFile); % Delete the zip file
% Now plot the resulting shape file... numerous options in folder with varying levels of detail, pick adm0 set.
figure; % Make a new figure
shapeFile = ['.' filesep 'shapeFileFolder' filesep countryCode '_adm0.shp']; % Get the desired shape file
geoshow(shapeFile); % Plot it up. High detail data so this could take a while.
axis off; % Style preference, turn off plot axis and just show country
% The above is pretty high detail (i.e. slow). If you'd like to down-sample the data so it loads faster, then do the following:
country = shaperead(shapeFile); % Read shape file
[X, Y] = reducem(country.X',country.Y',0.01); % Play with tolerance to your liking
figure; % Make a new figure
figure;geoshow(Y,X,'displaytype','polygon'); % Plot it up, just like above, only faster (lower resolution)
axis off; % Style preference, turn off plot axis and just show country
Paul Shoemaker

Sign in to comment.

More Answers (0)

Sign in to answer this question.