Convert Raster Function Template (Data Management)

Summary

Converts a raster function template between formats (rft.xml, json, and binary).

Usage

  • Raster function templates can be stored in XML, JSON, or binary format.

  • Since some formats work better on the web, you can convert your raster function template between formats. For example, you may want to convert your rft.xml function template to JSON so that you can use the template in an image service REST API.

Parameters

LabelExplanationData Type
Input Raster Function Template

The input raster function template file. The input template file can be XML, JSON, or binary format.

File; String
Output Raster Function Template File

The output raster function template file path and file name.

File
Format
(Optional)

The output function template file format.

  • XMLXML output format.
  • JSONJSON output format. This is the default.
  • BinaryBinary output format.
String

arcpy.management.ConvertRasterFunctionTemplate(in_raster_function_template, out_raster_function_template_file, {format})
NameExplanationData Type
in_raster_function_template

The input raster function template file. The input template file can be XML, JSON, or binary format.

File; String
out_raster_function_template_file

The output raster function template file path and file name.

File
format
(Optional)

The output function template file format.

  • XMLXML output format.
  • JSONJSON output format. This is the default.
  • BINARYBinary output format.
String

Code sample

ConvertRasterFunctionTemplate example 1 (Python window)

This is a Python sample for the ConvertRasterFunctionTemplate tool.

##Convert Raster Function Template

## Usage: ConvertRasterFunctionTemplate_management(in_raster_function_template,
##                   out_raster_function_template_file, {JSON | XML | BINARY})


import arcpy

#Convert rft.xml to json

arcpy.ConvertRasterFunctionTemplate_management("c:\\test\\NDVI.rft.xml", "C:\\Test\\json_NDVI.rft.json")
ConvertRasterFunctionTemplate example 2 (stand-alone script)

This is a Python script sample for the ConvertRasterFunctionTemplate tool.

#import arcpy module
import arcpy

#Set input parameters
in_json = "c:\\test\\aspect.json"
out_rftxml = "c:\\test\\aspect.rft.xml"
out_file_type = "XML"

#Convert json to rft.xml
arcpy.ConvertRasterFunctionTemplate_management(in_json, out_rftxml, out_file_type)