Refactor write_raster_extent for reuse.