Two transformers to look at will be the TextDecoder (can decoded the base64) and the AttributeFileWriter which can write the contents of an attribute to a file
Two transformers to look at will be the TextDecoder (can decoded the base64) and the AttributeFileWriter which can write the contents of an attribute to a file
Hi @hkingsbury, thanks for your help, it helped to show the way to unlock AI capabilities in FME 2024, using PythonCaller I asked to the AI and it provided this code:
import fme import fmeobjects
class FeatureProcessor(object):
def __init__(self): pass
def input(self, feature: fmeobjects.FMEFeature): # Retrieve the _response_body attribute from the feature response_body = feature.getAttribute('_response_body')
# Assuming response_body contains binary data for the raster # Convert the binary data to a raster file # This example saves the raster to a temporary file. Adjust the path as necessary. raster_file_path = r'YOURFILEPATH\raster.tif' with open(raster_file_path, 'wb') as file: file.write(response_body)
# Optionally, set the path of the raster file as an attribute to the feature feature.setAttribute('rasterFilePath', raster_file_path)
# Output the feature self.pyoutput(feature)
This helped to convert my api _responsebody input data and then stored it into the specific path.
Sharing it to newbies in the future to have a nice way to solve this issue.