How to plot boundaries region contours of countries in worldmap?

21 ビュー (過去 30 日間)
Emrys
Emrys 2018 年 3 月 1 日
コメント済み: Emrys 2018 年 3 月 2 日
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
Emrys
Emrys 2018 年 3 月 2 日
Thank you Mr Shoemaker for your help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenomics 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