Main Content

Combine Vector and Raster Geodata on the Same Map

Vector map variables and data grid variables are often used or displayed together. For example, continental coastlines in vector form might be displayed with a grid of temperature data to make the latter more useful. When several map variables are used together, regardless of type, they can be referred to as a single map. To do this, of course, the different data sets must use the same coordinate system (i.e., geographic coordinates on the same ellipsoid or an identical map projection).

Combining Raster Data and Vector Data on the Same Map

This example shows how to combine raster data and vector data on the same map using the geoshow function.

First, load elevation raster data and a geographic cells reference object. Get the coordinates of coastlines as vectors.

load topo60c
load coastlines

Create a map axes object that uses the Robinson projection. Then, display the raster and apply a colormap appropriate for elevation data.

axesm robinson

Figure contains an axes. The axes contains an object of type surface.

Display the vectors in red on top of the elevation map.


Figure contains an axes. The axes contains 2 objects of type surface, line.