Importing geographical maps in matlab

I wish to create an interactive map in Matlab. For that, I need to import a geographical map of Botswana in Matlab. I am getting stuck with that. Kindly do help

1 件のコメント

Ojaswita
Ojaswita 2015 年 3 月 26 日
Still awaiting any possible answers. I have used the worldmap and geoshow functions in Matlab but that does show the country boundaries. Please do help!

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

 採用された回答

Chad Greene
Chad Greene 2015 年 4 月 3 日

0 投票

Using borders,
worldmap('africa') % initializes a map
borders('countries') % outlines all countries
borders('botswana','r-','linewidth',2) % outlines Botswana in red
labelborders('Botswana') % labels Botswana

7 件のコメント

Ojaswita
Ojaswita 2015 年 4 月 9 日
Thanks alot! But I get an error:
??? Undefined function or method 'borders' for input arguments of type 'char'.
Thomas Koelen
Thomas Koelen 2015 年 4 月 9 日
Type
ver
in your command window, does it show mapping toolbox in the list of toolboxes that show up?
If it doesn't youll have to buy it to use these functions.
Chad Greene
Chad Greene 2015 年 4 月 9 日
編集済み: Chad Greene 2015 年 4 月 9 日
Ojaswita, That error means Matlab can't find the borders function. Download it from the File Exchange site, place borders.m in your current Matlab folder, and the code above should work. You do not need the Mapping Toolbox to use the borders function.
Ojaswita
Ojaswita 2015 年 8 月 16 日
I have downloaded the border.m from the following link: http://www.mathworks.com/matlabcentral/fileexchange/50390-borders
I added the folder using pathtool... and i run the exact same code as the one provided by Chad. And i still get the same error
Ojaswita
Ojaswita 2015 年 8 月 20 日
I managed to draw the maps by doing some changes in the coding. I am now facing trouble with marking the cities with a marker point on the map. I have tried text, textm, plot, plotm, annotation and many others, but none of them give any result or error.
Ojaswita
Ojaswita 2015 年 9 月 10 日
I downloaded the borders.m file from file exchange to draw the maps of different countries. I had an older version of MATLAB earlier and I used the pathtool to add the folder into my directory. It worked perfectly and I got my results using the following code:
borders('botswana','b-','linewidth',2);
x = [-24.65; -21.17; -22.38; -23.1; -22.55; -19.98; -17.82; -21.7; -26.02; -24.41; -24.98];
y = [25.91; 27.51; 26.72; 26.8; 27.13; 23.42; 25.15; 21.65; 22.4; 25.5; 25.35];
cities = {'Gaborone', 'FTown', 'Serowe', 'Mahalapye', 'Palapye', 'Maun', 'Kasane', 'Ghanzi', 'Tsabong', 'Molopolole', 'Kanye'};
plotm(x,y, 'x', 'MarkerSize', 10, 'LineWidth', 2)
textm(x,y, cities)
Now I upgraded to MATLAB 2013a, and I try to run the same code (after trying to add the borders files in the directory using different methods), and I get the following error:
Error using referenceSphere The specified superclass 'spheroid' contains a parse error or cannot be found on MATLAB's search path, possibly shadowed by another file with the same name.
Could I get some light on how to sort this out, please please
Hamza Rehman
Hamza Rehman 2018 年 4 月 5 日
@Chad Greene thanks man!!!!! you really are a gem of a person.. I was stuck here and got the solution Thanks again!!!

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by