CopyRaster Environment Settings Not Being Applied

2319
5
08-30-2013 04:36 AM
PatrickDoody
New Contributor II
I am making a call to arcpy.CopyRaster_management to convert some miscellaneous rasters into JPEG2000 *.jp2 files. Before making a call to this line, I want to set a few arcpy.env environment settings to be applied to the copy. Specifically, I would like to specify compression, pyramid, and tilesize.

My code looks like the following:

# Specifying the environment settings
arcpy.env.workspace = outWorkspace
arcpy.env.tileSize = "512 512"
arcpy.env.compression = "JPEG2000 75"
arcpy.env.pyramid = "NONE"
#Copying the raster
arcpy.CopyRaster_management(filepath,name + ".jp2","DEFAULTS","0","0","","ColormapToRGB","8_BIT_UNSIGNED")


The actual raster copies, and is correct. However, my arcpy.env settings are not applied. For example, my tileSize is not set to the specified 512x512, and the *.ovr overviews file is created even though I specified for pyramids to not be created ("NONE").

I am referencing the below document for CopyRaster_management: http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000094000000
At the bottom of the document under "Environments" it lists the environment settings and the tileSize, compression, and pyramid options are listed, so I assume these should be getting applied.

Am I applying these environment settings incorrectly? How can I prevent overviews from being created, and my tileSize from being correctly applied? Any help is appreciated, thanks.
Tags (2)
0 Kudos
5 Replies
JamesCrandall
MVP Frequent Contributor
What is your output workspace/storage? 

Here is the Raster Storage Matrix to see if those parameters are available for the storage type you are writing to:

http://resources.arcgis.com/en/help/main/10.1/index.html#//001w00000024000000
0 Kudos
JakeSkinner
Esri Esteemed Contributor
Hi Patrick,

The tile size only affects rasters that are stored in TIFFs, file geodatabases, or an SDE geodatabase.  See the following link:

http://resources.arcgis.com/en/help/main/10.2/index.html#//001w00000021000000

As for the pyramids not being built, I found the following bug, NIM070791:

The geoprocessing tool, Copy Raster, builds pyramids even if the build  pyramids check box in the 'Environment Variable' is unchecked. This  happens only when the output is a file raster (TIFF) and when setting  any of the parameters like 'Ignore background value', 'colormapToRGB' or  'convert 1 bit data to 8 bit data.'  

This appears to occur for JP2 as well as TIFF files.  When not specifying the 'Colormap to RGB' option, the OVR file is not created.
DorothyMortenson
Occasional Contributor II
I'm having a similar issue. I cannot seem to get the compression environment to work.
I have tried it in a python script with
arcpy.env.compression = "JPG 50"

I get no compression

(original is a tif)

I also tried using ArcTools and change the Raster Storage parameters and get the same thing. No compression.

Did anyone ever figure this out?

Dorothy
0 Kudos
PaulCone
New Contributor III

Same here -- my script has

arcpy.env.compression = "JPEG2000"

but I end up with LZ77 anyway, which results in a dataset that is too huge.  If I can't script this then I have to run it by hand to get the result I need.

Paul

-------------------------------------------

Paul Cone

Corporate GIS

City of Portland, Bureau of Technology Services

paul.cone@portlandoregon.gov

0 Kudos
JeniferCochran1
New Contributor II

Is this still an issue in ArcMap 10.4.1? 

0 Kudos