Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

programmatically add Attribute Table Function to Mosaic Dataset

$
0
0
I am trying to programmatically add a DBF file containing themes/color values to a Mosaic Dataset using arcpy.EditRasterFunction_management. It runs without errors but it's not working because after I run my script I don't see any color in my mosaic dataset nor do I see Attribute Table Function in the Function Chain of the Mosaic Dataset Properties.

Here's my stand-alone script:

import arcpy

arcpy.env.workspace = "D:/is_server_config/export/MD/toddo.gdb"
mdname = "HI_120EVC"
editmode = "EDIT_MOSAIC_DATASET"
editmethod = "INSERT"
funcfile = "D:/services_mxds/publish_image_service/attr_table_function.rft.xml"
funcname = "Attribute Table Function"

arcpy.EditRasterFunction_management(mdname, editmode, editmethod, funcfile, funcname)



Here's my attr_table_function.rft.xml template which I exported from the Raster Function Template Editor. The only thing I modified in the template was the red section which points to my DBF file.

<XmlRasterFunctionTemplate xsi:type='typens:RasterFunctionTemplate' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.1'>
<Name>empty_attr_table_function</Name>
<Description>A raster function template.</Description>
<Function xsi:type='typens:TableFunction'>
<Name>Attribute Table Function</Name>
<Description>Associates a raster attribute table to a given single band raster.</Description>
<PixelType>S16</PixelType>
</Function>
<Arguments xsi:type='typens:TableFunctionArguments'>
<Names xsi:type='typens:ArrayOfString'>
<String>Raster</String>
<String>D:\is_server_config\export\MD\HI_120EVC.dbf</String>
</Names>
<Values xsi:type='typens:ArrayOfAnyType'>
<AnyType xsi:type='typens:RasterFunctionVariable'>
<Name>Raster</Name>
<Description>
</Description>
<Value>
</Value>
<IsDataset>true</IsDataset>
</AnyType>
<AnyType xsi:type='typens:RasterFunctionVariable'>
<Name>AttributeTable_2014413_165548_590</Name>
<Description>
</Description>
<Value xsi:nil='true'/>
<IsDataset>false</IsDataset>
</AnyType>
</Values>
</Arguments>
<Help>
</Help>
</XmlRasterFunctionTemplate>

I know there is nothing wrong with the DBF because I'm able to manually add the DBF to my Mosaic Dataset using Properties->Functions tab ...

What am I doing wrong?
Thank you for your help.

Viewing all articles
Browse latest Browse all 2485

Trending Articles