Converting between rasters and vectors