Raster Functions, update specific rasters. (Loop)

974
2
Jump to solution
04-24-2013 07:23 AM
TonyGegner
New Contributor III
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,
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
TonyGegner
New Contributor III
I managed to solve it.

Since i create a TEMPLAYER MakeMosaicLayer_management() to work with.
I need to specify this TEMPLAYER on the next loop as MOSAIC_DATASET.

Also every other function in my script need to work with the new TEMPLAYER variable.
Otherwise it crashes.

View solution in original post

0 Kudos
2 Replies
TonyGegner
New Contributor III
Any help is appreciated. Might there be a better/easier way to create/update �??Raster Functions�?� on specific raster images? I haven�??t found any real examples doing this.
0 Kudos
TonyGegner
New Contributor III
I managed to solve it.

Since i create a TEMPLAYER MakeMosaicLayer_management() to work with.
I need to specify this TEMPLAYER on the next loop as MOSAIC_DATASET.

Also every other function in my script need to work with the new TEMPLAYER variable.
Otherwise it crashes.
0 Kudos