Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a polygon shapefile with a UTM projection which I read into MATLAB:

s = 'C:\path\to\shapefile.shp'

% Read the shapefile
shp = shaperead(s);

How can I convert this simply polygon into a binary raster grid of 0's and 1's in MATLAB? My goal is to multiply the binary grid/array by another array to "mask" out areas outside my region of interest.

share|improve this question
maybe poly2mask could help (after extracting X and Y from your struct array). –  radouxju Mar 5 '14 at 7:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.