ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Workspace To Mosaic

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

Summary

Mosaics all the raster datasets in a workspace, or geodatabase, to an output raster dataset. The output raster dataset must already exist.

Legacy:
This tool has been deprecated. For more information, see An overview of the Samples toolbox.

Usage

  • Mosaic is useful when two or more adjacent raster datasets need to be merged into one entity. Some mosaic techniques can help minimize the abrupt changes along the boundaries of the overlapping rasters.

  • For mosaicking of discrete data, First, Minimum, or Maximum Mosaic Operator options will provide the most meaningful results. The Blend and Mean Mosaic Operator options are best suited for continuous data.

  • This tool will automatically resample the raster datasets using nearest neighbor resampling, which is not appropriate for continuous data types. If your raster inputs have floating point values with pixels that do not completely line up, you need to resample your floating-point input raster datasets with the bilinear interpolation or cubic convolution methods before you run the mosaic process.

  • The output raster must already exist since the input raster dataset will all be mosaicked into it. This raster dataset cell size determines the cell size for the entire mosaic.

  • If an output raster dataset does not already exist, you can use the Mosaic to New Raster tool, or create an empty raster dataset prior to running this tool.

  • This sample tool was created using Python. The code can be viewed and edited to help you write your own scripts.

  • The Raster Analysis Environments are not valid for this tool.

Syntax

arcpy.samples.WorkspaceToMosaic(input_workspace, output_raster, {mosaic_method}, mosaic_colormap_mode, {ignore_background_value}, {nodata_value}, {convert_1_bit_data_to_8_bit}, {mosaic_tolerance})
ParameterExplanationData Type
input_workspace

The input workspace can be a directory or a geodatabase.

Folder | Workspace
output_raster

The output raster dataset into which the other input raster datasets are mosaicked. The output raster dataset must already exist.

Raster Dataset
mosaic_method
(Optional)

The method used to mosaic overlapping areas.

  • FIRST —The output cell value of the overlapping areas will be the value from the first raster dataset mosaicked into that location.
  • LAST —The output cell value of the overlapping areas will be the value from the last raster dataset mosaicked into that location. This is the default.
  • BLEND —The output cell value of the overlapping areas will be a horizontally weighted calculation of the values of the cells in the overlapping area.
  • MEAN —The output cell value of the overlapping areas will be the average value of the overlapping cells.
  • MINIMUM —The output cell value of the overlapping areas will be the minimum value of the overlapping cells.
  • MAXIMUM —The output cell value of the overlapping areas will be the maximum value of the overlapping cells.
  • SUM —The output cell value of the overlapping areas will be the total sum of the overlapping cells.
String
mosaic_colormap_mode

The method used to choose which color map from the input rasters will be applied to the mosaic output.

  • FIRST —The color map from the first raster dataset in the list will be applied to the output raster mosaic. This is the default.
  • LAST —The color map from the last raster dataset in the list will be applied to the output raster mosaic.
  • MATCH —Will take all the color maps into consideration when mosaicking. If all possible values are already used (for the bit depth), it will attempt to match the value with the closest color that is available.
  • REJECT —Only the raster datasets that do not have a color map associated with them will be mosaicked.
String
ignore_background_value
(Optional)

Use this option to remove the unwanted values created around the raster data. The value specified will be distinguished from other valuable data in the raster dataset. For example, a value of zero along the raster dataset's borders will be distinguished from zero values in the raster dataset.

The pixel value specified will be set to NoData in the output raster dataset.

For file-based rasters and geodatabase rasters, the Ignore Background Value must be set to the same value as NoData for the background value to be ignored. Enterprise geodatabase rasters will work without this extra step.

Double
nodata_value
(Optional)

All the pixels with the specified value will be set to NoData in the output raster dataset.

Double
convert_1_bit_data_to_8_bit
(Optional)

Choose whether the input 1-bit raster dataset will be converted to an 8-bit raster dataset. In this conversion, the value 1 in the input raster dataset will be changed to 255 in the output raster dataset. This is useful when importing a 1-bit raster dataset to a geodatabase. One-bit raster datasets have 8-bit pyramid layers when stored in a file system, but in a geodatabase, 1-bit raster datasets can only have 1-bit pyramid layers, which makes the display unpleasant. By converting the data to 8 bit in a geodatabase, the pyramid layers are built as 8 bit instead of 1 bit, resulting in a proper raster dataset in the display.

  • NONE —No conversion will be done. This is the default.
  • OneBitTo8Bit —The input raster will be converted.
Boolean
mosaic_tolerance
(Optional)

When mosaicking takes place, the target and the source pixels do not always line up exactly. When there is a misalignment of pixels, a decision needs to be made whether resampling takes place or whether the data should be shifted. The mosaicking tolerance controls whether resampling of the pixels take place or if the pixels should be shifted.

If the difference in pixel alignment (of the incoming dataset and the target dataset) is greater than the tolerance, resampling will take place. If the difference in pixel alignment (of the incoming dataset and the target dataset) is less than the tolerance, resampling will not take place (instead, a shift is performed).

The unit of tolerance is a pixel, where the valid value range is 0 to 0.5. A tolerance of 0.5 will guarantee a shift takes place. A tolerance of zero guarantees resampling, if there is a misalignment in pixels.

For example, the source and target pixels have a misalignment of 0.25. If the mosaicking tolerance is set to 0.2, then resampling will take place since the pixel misalignment is greater than the tolerance. If the mosaicking tolerance is set to 0.3, then the pixels will be shifted.

Double

Code sample

import arcgisscripting
gp = arcgisscripting.create()
 
gp.WorkspaceToMosaic_samples("D:\\temp\\tempws", "Database Connections\\raster.sde\\RASTER.WRKSPTOMOSAIC", "LAST", "FIRST", "#", "#", "#", "0")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal