How to plot boundaries region contours of countries in worldmap?

조회 수: 30 (최근 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 CenterFile Exchange에서 View and Analyze Simulation Results에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by