MATLAB: How to convert a raster geodata into vector geodata using the Mapping Toolbox

.shpconversioncountourgeodatageostructmappingMapping Toolboxrastershapetoolboxvector

I would like to have a way of converting raster geodata into a vector geodata and then plot it. My geodata represents terrain relief and I would like to extract contour lines from it.

Best Answer

The raster geodata can be converted into a vector geodata in the Mapping Toolbox as described in the example below:
1. Set up a map axes using WORLDMAP
2. Use CONTOURM to plot and return contours of that surface
3. Parse the contour matrix from CONTOURM into a version 2 latitude/longitude geostruct
4. Construct a symbolspec for the vectors and display the geostruct using GEOSHOW
You can download the attached file "extractContours.m" which implements the steps mentioned above.
Related Question