How to adress e.g. Footprint in mosaic dataset from Modelbuilder and in Python

3340
8
01-24-2011 03:13 AM
MichaelStjernholm
New Contributor III
Hi

As a part of a processing model in Modelbuilder where I create a new Mosaic dataset, add Raster to the moaic, Build Seamlines and Footprints I want to access these feature classes inside a mosaic dataset.

I want e.g. to add field to the Seamline feature class and export the Footprint feature class but have difficulties in specifying the right name, given that I provided the Mosaic Workspace and Mosaic name - can anyone give me a hint?

In Python I'm struggling with the fact that although the source name of mosaic dataset might be something like  "MyRasterMosaic" then when the look at the properties of the Footprint layer, the data source Tab tells you that the source is a Raster catalog with the name AMD_MyRasterMosaic_CAT
How should the Footprint layer inside a Raster Mosaic be referred to in e.g. a CopyFeatures_management( ) statement ?

best regards

Michael
0 Kudos
8 Replies
JieZhang
Esri Contributor
Hi Michael,

Thanks for asking! We had quite a few questions referring to the issue you mentioned here.

You can try the following python code snippet to access the features in the mosaic dataset.

#************************************************************

import arcpy

inMD = r"c:\temp\fgdb.gdb\mosaicds"

arcpy.MakeMosaicLayer_management(inMD, "mdlayer")
arcpy.CopyFeatures_management("mdlayer\Footprint", r"c:\temp\mdfootprint.shp")

#************************************************************

It is similar in the model builder. You need to use the Make Mosaic Layer tool before you can have the access to the feature classes in the mosaic dataset.

Check out the attached screenshot, the input of Copy Features tool will be the output mosaic layer variable name plus the feature (e.g. Footprint) you request.


Jie
0 Kudos
MapEnglish
Occasional Contributor
How would I edit an attribute of the Footprint layer? CopyFeatures creates a copy which I can edit, but I want to edit the source footprint attributes.

Thanks,
Matt English
Esri Canada
0 Kudos
JoeFlannery
Occasional Contributor III
Jie:

I am using ArcGIS Desktop Advanced (ArcInfo) version 10.1 and I cannot get your workflow to work for me.  See attached screen capture of my model.  The Copy Features tool does not recognize %MosaicLayer%\Footprint as an input parameter.  Do you have any other suggestions?

Thank you.
0 Kudos
BobBell
New Contributor
Jie:

I am using ArcGIS Desktop Advanced (ArcInfo) version 10.1 and I cannot get your workflow to work for me.  See attached screen capture of my model.  The Copy Features tool does not recognize %MosaicLayer%\Footprint as an input parameter.  Do you have any other suggestions?

Thank you.


Hi Joe, did you ever get this to work? I'm having the same problem!
0 Kudos
JoeFlannery
Occasional Contributor III
Bob:  Sorry, I never found a solution to this issue.
0 Kudos
DavidMartin
Occasional Contributor II
This appears to be a tool validation issue. If I create this same model in Model Builder, and run the "Make Mosaic Layer" portion of it, I can then validate the entire model and it will run OK - whether within Model Builder or subsequently via the tool's UI (provided default parameters exist and I don't change them). Whenever I do change the parameters, however, it errors with the message that %MosaicLayer%\Footprint does not exist.

I'd say that the tool is treating %MosaicLayer%\Footprint as a necessary prerequisite to running the model. If it's there (in memory?) due to previous runs of the model in Model Builder, then all's well. Otherwise it won't validate.

Looks like a bug? I am also running 10.1 (SP1).

However there is a workaround - using the Calculate Value tool in Model Builder. The model shown in the attached screenshot will run OK.
0 Kudos
DavidMartin
Occasional Contributor II
Also relevant here is that you can use tools like Add Field to add attributes to the Footprint layer. The Add Field tool, and others like it (e.g. Calculate Field) will take a Mosaic Dataset as an input (as-is) and will apply their actions directly to the Footprint layer.
0 Kudos
ChrisMerkord
New Contributor
I know this is an old thread, but is the first thing that pops up in Google when you search for the same problem, and it was never answered here.  I found a solution and wanted to share it.

I had the same problem, that when I used %Output Mosaic Layer%\Footprint the model would not run. It said the copy input feature did not exist. However when I removed the percent signs and typed just Output Mosaic Layer\Footprint it did work. Alternatively, I could just select the layer from the dropdown menu.

EDIT:

Actually this only worked in the Model Builder if I manually ran the Make Layer tool first. Otherwise it continues to fail. helyxsisltd's solution using Calculate worked though.
0 Kudos