I have a folder with ~1200 aerial photos in both jp2 and tif format, of which I need about 380. I wrote a python script to get the names of the files I need, which works fine. But when the script copies the data, 1. it goes very slowly, 2. the file size for the jps file expands from 92k kb to 200k kb or more. It also creates ovr files an the 150K kb range. Is this normal? ArcGIS 10.0 all round. Thanks.
lst_names = arcpy.SearchCursor(raster_names, "", "", name_field, name_field)
for row in lst_names:
arcpy.CopyRaster_management(from_folder + row.name, to_folder + row.name)
Answer
If you simply want to copy the rasters without changing format, compression, or building overviews then use standard filesystem copy (in the shutil module) instead of the CopyRaster tool as i.e.
import shutil
shutil.copy(inpath, outpath)
You could also use the Copy tool
arcpy.Copy_management(inpath, outpath)
The advantage of the Copy tool is that it will also copy all related files, i.e if you are copying someraster.tif then someraster.tfw and someraster.aux.xml etc... will also get copied.
No comments:
Post a Comment