I'm trying to programmatically export a symbolized raster to an RGB TIF using ArcGIS, i.e.: perform the equivalent of Export Raster Data in ArcMap with Use Renderer and Force RGB activated.
I followed the beginning of Use python to disable "Scale map elements proportionally to changes in page size" to access ArcObjects in Python.
I'm trying to re-create the code in this discussion to eventually create a RasterLayerExport object. Before that, though, I find myself incapable of creating a WorkspaceFactory.
I tried running:
import arcpy
from snippets102 import *
from comtypes.client import GetModule, CreateObject
import comtypes.gen.esriFramework as esriFramework
import comtypes.gen.esriArcMapUI as esriArcMapUI
import comtypes.gen.esriCarto as esriCarto
import comtypes.gen.esriDisplay as esriDisplay
import comtypes.gen.esriGeoDatabase as esriGeoDatabase
wkspf = CreateObject(esriGeoDatabase.WorkspaceFactory, interface = esriGeoDatabase.IWorkspaceFactory)
But this gives me the following error:
Traceback (most recent call last):
File "C:/Users/AndyPL/.PyCharmCE2017.2/config/scratches/scratch_1.py", line 14, in <module>
wkspf = CreateObject(esriGeoDatabase.WorkspaceFactory, interface=esriGeoDatabase.IWorkspaceFactory)
File "C:\Python27\ArcGIS10.4\lib\site-packages\comtypes\client\__init__.py", line 238, in CreateObject
obj = comtypes.CoCreateInstance(clsid, clsctx=clsctx, interface=interface)
File "C:\Python27\ArcGIS10.4\lib\site-packages\comtypes\__init__.py", line 1225, in CoCreateInstance
_ole32.CoCreateInstance(byref(clsid), punkouter, clsctx, byref(iid), byref(p))
File "_ctypes/callproc.c", line 945, in GetResult
WindowsError: [Error -2147221164] Class not registered
Odd, since creating a PlugInWorkspaceFactory works fine. Does anyone else get this error?
wkspf = CreateObject(esriGeoDatabase.RasterWorkspaceFactory, interface = esriGeoDatabase.IWorkspaceFactory)
?