I want to drew a map based on longitude and latitude limits and i want the to see the countries borders

17 views (last 30 days)
Hey I m new to matlab so this might be basic stuff.
I have data that i want to plot on a map of the middel east. plotting I got the handel of.
i tried using world map, but i dont want the all map off the world, i just want the midel east, preferably i would like a finction that alows me to load a map according to longitude and latitude limits (and present them).
i also wanted to see the countries borders on the map, when i tries using 'borders' finction matlab said: "Unrecognized function or variable 'borders' " i use matlab R2021b
help please,
and thank you!

Answers (1)

Kevin Holly
Kevin Holly on 16 Mar 2022
Edited: Kevin Holly on 16 Mar 2022
figure
ax=axes;
land = readgeotable("landareas.shp");
geoshow(land,"FaceColor",[0.15 0.5 0.15])
lakes = readgeotable("worldlakes.shp");
geoshow(lakes,"FaceColor","blue")
rivers = readgeotable("worldrivers.shp");
geoshow(rivers,"Color","blue")
ax.XLim = [14 80]; %Longitude
ax.YLim=[10 45]; %Latitude
figure
worldmap([10 45],[14 80])
geoshow(land,"FaceColor",[0.15 0.5 0.15])
geoshow(lakes,"FaceColor","blue")
geoshow(rivers,"Color","blue")
I believe the border function you are looking for is found on the File Exchange here.
  1 Comment
Steven Lord
Steven Lord on 16 Mar 2022
Note that many of the functions used in this answer (readgeotable and geoshow in particular) are part of Mapping Toolbox, so you would need to have that toolbox licensed and installed to use those functions.
If you do have Mapping Toolbox the toolbox includes some data files that could be useful as well as functions that allow you to access geospatial data online.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!