Question: Is it possible to have FME write .ovr files with a GeoTIFF (Georeferenced Tagged Image File Format) writer?
The Solution I am hoping for:
- An FME solution for writing .ovr pyramid files
- 2nd best would be solutions to the Python/ArcPy errors I'm getting when running ArcGIS geoprocessing tools
- 3rd best would be another plan for writing .ovr files.
My Software:
- Safe: FME(R) 2018.1.0.3 (20180926 - Build 18552 - WIN64)
- Esri: ArcGIS desktop 10.6.1 version 10.6.1.9270 with Background Geoprocessing (64-Bit)
Basic Background:
I am developing a process for a couple thousand tiff images that will be used in ArcGIS (it's not relevant but I'm using a parent workspace with WorkspaceRunner to run this child workspace). Ideally my FME workspace would write GeoTIFF images with pyramids in a format read by ArcGIS (apparently its an .ovr file), that way the features written are a final product for use in ArcMap.
The Issue I am having:
My problem is that I am not able to get the GeoTIFF writer's "Generate Pyramids" parameter or the RasterPyramider transformer to write an .ovr with the .tif.
When an image is imported into ArcMap, ArcGIS looks for a .ovr file (imagename.tif.ovr) for pyramids; if an .ovr is not found then ArcGIS prompts the user to create pyramids.
ArcGIS provides methods to overcome this: with lots of images ArcMap can take a lot of time and processing power to generate the pyramids, however I can use the ArcGIS "BuildPyramids" or "Batch Build Pyramids" geoprocessing tool to build these pyramids reasonably quickly.
As mentioned above, I'd like to have the entire process contained within FME and it seems like FME should be up to the task.
What I've tried - (a) - RasterPyramider & GeoTIFF writer
I've read over and tinkered with FME's article "Raster Pyramiding Example" (as well as a few posts that popped up such as this one with no luck). Since I didn't see any mention of .ovr files on the FME website so I moved on to python.
What I've tried - (b) - Python Caller
On the ArcGIS end I'm using ArcGIS desktop 10.6.1 Python is not my strength, however I attempted to use a PythionCaller to run this arcpy script:
import fme
import fmeobjects
import arcpy
#Build Pyramids for single Raster Dataset
#Define the type and compression of pyramids in the tool
#Skip if dataset already has pyramids
def processFeature(feature):
ÂÂ ÂÂ # Get tif Image FC and settings from feature attributes
ÂÂ ÂÂ dataset = feature.getAttribute('fme_dataset')
ÂÂ ÂÂ arcpy.env.workspace = dataset
ÂÂ ÂÂ ÂÂ
ÂÂ ÂÂ #Set Local Variables
ÂÂ ÂÂ imageName = feature.getAttribute('_filename')
ÂÂ ÂÂ inras = imageName
ÂÂ ÂÂ pylevel = "8"
ÂÂ ÂÂ skipfirst = "NONE"
ÂÂ ÂÂ resample = "NEAREST"
ÂÂ ÂÂ compress = "DEFAULT"
ÂÂ ÂÂ quality = "90"
ÂÂ ÂÂ skipexist = "SKIP_EXISTING"
ÂÂ ÂÂ arcpy.BuildPyramids_management(inras, pylevel, skipfirst, resample, compress, quality, skipexist)
This resulted in this error:
Python Exception <ImportError>: No module named arcpy
So I searched around and reviewed these threads:
- https://knowledge.safe.com/questions/27519/using-arcpy-python-module-inside-fme.html
- https://knowledge.safe.com/questions/54849/fme-python-cant-find-module-arcpy.html
- https://knowledge.safe.com/articles/29799/importing-arcpy-troubleshooting-ideas.html
What I've tried - (c) - Python Caller
I tried a number of the things suggested, it seemed the most successful was adding this to the PythonCaller:
import sys
fmePydPath = r'C:\Program Files (x86)\ArcGIS\Desktop10.6\arcpy' ÂÂ #Add arcpy directory
fmePydPath2 =r'C:\Program Files (x86)\ArcGIS\Desktop10.6\bin' #Add arcgis directory
if fmePydPath2 not in sys.path: sys.path.append(fmePydPath2) ÂÂ #Try to add path
if fmePydPath not in sys.path: sys.path.append(fmePydPath)
This got me past the previous error and moved me right along to getting this error:
Python Exception <ImportError>: DLL load failed: %1 is not a valid Win32 application
Some how that felt like an improvement...
This error led me to the ArcGIS forum community. I tested out a number of suggestions but unfortunately I found no working solution (example: https://community.esri.com/thread/69510).
Without a stroke of genius I' suppose I'll need to uninstall/reinstall ArcGIS and their x64 processing.