How to plot boundaries region contours of countries in worldmap?

21 次查看(过去 30 天)
Hi guys, i have to plot with worldmap , all the region of the Italian country. Is there any way of doing this?

采纳的回答

Paul Shoemaker
Paul Shoemaker 2018-3-1

I've used the website http://www.gadm.org/ 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

http://www.matlabinvesting.com

  2 个评论
Paul Shoemaker
Paul Shoemaker 2018-3-1
As a follow-up, you can download and plot Italy using the below snippet of code.
countryCode = 'ITA'; % Country code for Italy
baseURL = 'http://biogeo.ucdavis.edu/data/gadm2.8/shp/???_adm_shp.zip'; % 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 = 'temporary_shapefile.zip'; % 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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Genomics and Next Generation Sequencing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by