Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have the following model in ModelBuilder:

Model

Get Raster Properties looks like this . . . Get Raster Properties I need to find the minimum cell size value to use as output. Any ideas on what tool I should use to replace Cell Statistics? Thanks, Renee


As I said above, the reason I need to get the minimum value of the cell size is because I need to create an empty output raster dataset that has compatible characteristics with the input rasters to be mosaicked together. However, I have another model that could get me around the above situation with having to create an output raster ahead of time. In the following model, I use "Mosaic to New Raster" rather than "Mosaic". This should work out well, but the output comes out crazy looking. Here is the model and the output . . . Mosaic To New Raster Model

Result of Mosaic To New Raster

share|improve this question
    
The screen shots in the original post got messed up for some reason, but I corrected them. Hope this didn't cause any confusion. –  Renee Cammarere Jun 13 '13 at 12:57

2 Answers 2

up vote 2 down vote accepted

Try this to get minimum cell size for collection of rasters:

  1. Add the Calculate Value tool to your inner model (iterate selected rasters) after Collect Values.

  2. Connect the Collect Values output as a precondition to Calculate Value.

  3. Define a small function within Calculate Value (Code Block) as shown below.

    def minCellSize(rasters):
     rasterList = rasters.split(";")
     return min([arcpy.Describe(r).meanCellHeight for r in rasterList])
    
  4. Type this in the expression minCellSize("%Rasters%")

  5. Set Double as the data type

  6. Set the output from Calculate Value as a model Parameter (The output from Collect values remains a model parameter)

  7. Connect the Calculate Value output to the cell size variable of the Mosaic To New Raster tool.

share|improve this answer

If you don't mind using a bit of arcpy you can implement the Describe function. As you iterate over your rasters simply use:

inRaster = 'C:\...\raster'
describeRaster = arcpy.Describe(inRaster)
cellSize = describeRaster.children[0].meanCellHeight # or .meanCellWidth

Now you can compare your cellSize variable to find the minimum.

EDIT:

You can get the minimum and maximum cell size of rasters in a mosaic dataset by using the Calculate Size Ranges tool.

share|improve this answer
    
Thanks for the suggestion. I'm looking for a geoprocessing tool that could take the collected values and get the minimum value. –  Renee Cammarere Jun 11 '13 at 18:33
    
Is the output of the entire model to be a single value (cell size)? If so, are you tied to using model builder? It seems like a more complex solution than necessary to get the minimum cell size. –  Nick Ochoski Jun 11 '13 at 18:39
    
I agree with you on that. Actually I'm working on this as a sub-model (one of about 6 or 7) to work with a Main model. I want to create a Main geoprocessing model that does the DTED mosaicking, slope generation and suitability. Then I would need to save it as a geoprocessing package. I'm taking it one step at a time. Thanks. –  Renee Cammarere Jun 11 '13 at 22:51
    
The reason I need to get the minimum value of the cell size is because I need to create an empty output raster dataset that has compatible characteristics with the input rasters to be mosaicked together. This is not the complete sub-model for this. I will also do a "CreateRasterDataset" after obtaining the proper cell size. –  Renee Cammarere Jun 11 '13 at 22:57
    
Thanks for clarifying. I edited my answer to include the Calculate Size Ranges geoprocessing tool. Using this would alter your routine though - you would have to mosaic the rasters and then calculate the cell sizes, which you could then use to resample the final dataset. Perhaps someone else can offer a more suitable solution. –  Nick Ochoski Jun 11 '13 at 23:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.