def _add_spatial_summary_to_zipfile(zip_out, arc_filename, size, squares):
    '''
    '''
    assert size in (.1, .2, .5, 1.)
    F = '{:.1f}'

    handle, tmp_filename = mkstemp(suffix='.csv'); close(handle)

    with open(tmp_filename, 'w') as output:
        columns = 'count', 'lon', 'lat', 'area'
        out_csv = DictWriter(output, columns, dialect='excel')
        out_csv.writerow({col: col for col in columns})

        for ((lat, lon), count) in squares.items():
            args = [F.format(n) for n in (lon, lat, lon + size, lat + size)]
            area = 'POLYGON(({0} {1},{0} {3},{2} {3},{2} {1},{0} {1}))'.format(*args)
            out_csv.writerow(dict(count=count, lon=F.format(lon), lat=F.format(lat), area=area))
    
    prefix, _ = splitext(arc_filename)
    support_csvname = join('summary', prefix+'-summary.csv')
    support_vrtname = join('summary', prefix+'-summary.vrt')
    
    # Write the contents of the summary file.
    zip_out.write(tmp_filename, support_csvname)

    with open(join(dirname(__file__), 'templates', 'source-summary.vrt')) as file:
        args = dict(filename=basename(support_csvname))
        args.update(name=splitext(args['filename'])[0])
        vrt_content = file.read().format(**args)

    # Write the contents of the summary file VRT.
    zip_out.writestr(support_vrtname, vrt_content)

    remove(tmp_filename)
dataset/ETHPy150Open openaddresses/machine/openaddr/ci/collect.py/_add_spatial_summary_to_zipfile/original