AnsweredAssumed Answered

Raster Functions, update specific rasters. (Loop)

Question asked by tony.gegneresri-se-esridist Employee on Apr 24, 2013
Latest reply on Apr 25, 2013 by tony.gegneresri-se-esridist
Hey all!

I'm trying a script that updates Raster Functions on specific rasters in the mosaic dataset.

The problem is that this code doesn't work when its in a loop.
I need the loop to make different querys depending on the raster that needs to be updated.

The first loop works great. OBJECTID=1 gets updated with correct settings.

Executing: EditRasterFunction Templayer EDIT_MOSAIC_DATASET_ITEM REPLACE W:\XMLTEMPLATE\4250_50_ii12.xml # Start Time: Wed Apr 24 17:08:09 2013 Working on AMD_image_CAT\Raster.OBJECTID = 1 Succeeded at Wed Apr 24 17:08:11 2013 (Elapsed Time: 2,00 seconds)


On the second loop (OBJECTID=2) it crashes on arcpy.MakeMosaicLayer_management().

ERROR 000622: Failed to execute (Make Mosaic Layer). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_mosaic_dataset.


Do i need to clear the Templayer somehow? Or what im i doing wrong?

# variables for test.. TEMPLATE = "URLToTemplate.xml" env.workspace = "C:\awsomeimages.gdb" MOSAIC_DATASET = "image"  try:  QUERY = "OBJECTID="+str(OBJECTID)  TEMPLAYER = "Templayer"  arcpy.MakeMosaicLayer_management( MOSAIC_DATASET,TEMPLAYER,QUERY )  arcpy.EditRasterFunction_management( TEMPLAYER,"EDIT_MOSAIC_DATASET_ITEM","REPLACE",TEMPLATE ) except:  print arcpy.GetMessages()


Best regards,

Outcomes