Re: Rasterizing polygon from numpy arrays

Brendan Ward

You need to convert each polygon in your numpy array of coordinates into a GeoJSON-like polygon.

You could use Shapely to do so.

You should then be able to use those as input to rasterize or geometry_mask.  Note that your polygons must be in the coordinate system of your images in order for this to work.  Since it sounds like your x,y dimensions of your images are in integer degrees, this means your x,y coordinates must also be in degrees (vertical axis shouldn't matter for rasterize / geometry_mask).

Hope that helps!

Join to automatically receive all group messages.