Is anyone aware if this question was ever answered? Even though it was posted several years ago, I am running into the same issue. However instead of rasters, I'm dealing with feature classes. I can filter the dropdown selection in the parameter by feature class type but am looking to filter this dropdown to specific feature class names.
That works well as I will know the names of the layers. The only issue that I have with this process is that it is possible that not all layers will be in the TOC and I do not want layers not in the TOC available in the dropdown.
I'm not sure how you can achieve this in Model Builder, but once you're model is completely finished, you can export it to a Python script, create a script tool, and use validation to customize the filter.
def initializeParameters(self): """Refine the properties of a tool's parameters. This method is called when the tool is opened.""" mxd = arcpy.mapping.MapDocument("CURRENT") lyrs = arcpy.mapping.ListLayers(mxd) compare_list = ['points','buff','something_else'] # the full list of layers you want to consider param_list =  for lyr in lyrs: if lyr.name in compare_list: param_list.append(lyr.name) # add to internal list self.params.filter.list = param_list # overwrite filter list return
Basically, yes. You can't (I don't think) change the parameter to a more appropriate type like Feature Class or Feature Layer because there will only be a Feature Class filter available, not Value List. Once you're more familiar with Python, you can clean up the exported code to change the inline variable substitution to more readable variables, but for now it should be fine.
I am getting the following when trying to add the code that you provided when updating the Validation. I am updating the compare_list with only those layers I want to consider in the TOC. Do you have any ideas what may be causing this? Thanks again.
Oh, you'll have to adjust the index number for self.params to match your interface. In my example, I specified self.params to mean the third parameter. The counting starts at zero.