How to plot boundaries region contours of countries in worldmap?

21 visualizaciones (últimos 30 días)
Hi guys, i have to plot with worldmap , all the region of the Italian country. Is there any way of doing this?

Respuesta aceptada

Paul Shoemaker
Paul Shoemaker el 1 de Mzo. de 2018

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 comentarios
Paul Shoemaker
Paul Shoemaker el 1 de Mzo. de 2018
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 el 2 de Mzo. de 2018
Thank you Mr Shoemaker for your help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Genomics and Next Generation Sequencing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by