Inspect and Display Vector Map Data

This example shows how to display vector map data and examine vector data values.

Load vector data set MAT-file of world coastlines and look at the variables created in the workspace. The variables coastlat and coastlon are vectors which together form a vector map of the coastlines of the world.

load coastlines
whos
  Name             Size            Bytes  Class     Attributes

  coastlat      9865x1             78920  double              
  coastlon      9865x1             78920  double              

View a map of this vector data. The example presents the map using a Mercator projection. A map projection displays the surface of a sphere (or a spheroid) in a two-dimensional plane. Points on the sphere are geometrically projected to a plane surface. There are many possible ways to project a map, all of which introduce various types of distortions.

axesm mercator
framem
plotm(coastlat,coastlon)

Inspect the first 20 coordinate values of the coastline vector data set.

[coastlat(1:20) coastlon(1:20)]
ans = 20×2

  -83.8300 -180.0000
  -84.3300 -178.0000
  -84.5000 -174.0000
  -84.6700 -170.0000
  -84.9200 -166.0000
  -85.4200 -163.0000
  -85.4200 -158.0000
  -85.5800 -152.0000
  -85.3300 -146.0000
  -84.8300 -147.0000
      ⋮

To see where these coastline vector points fall on the map, plot them in red. As you might have deduced by looking at the first column of the data, there is only one continent that lies below -80 latitude: Antarctica.

plotm(coastlat(1:20),coastlon(1:20),'r')