Skip To Content
ArcGIS Developer
Dashboard

Common Data Types

Mosaic rule objects

Description

License:

As of 10.5, you must license your ArcGIS Server as an ArcGIS Image Server in order to use this resource with a mosaic dataset.

The image service uses a mosaic rule to mosaic multiple rasters on-the-fly. The mosaic rule parameter is used by many image service operations, for example, export image and identify operations.

A mosaic rule is used to specify the following:

  • Selection of rasters to participate in the mosaic.
  • How selected rasters are ordered.
  • How overlapping pixels at the same location are resolved.

For more information, see Understanding the mosaicking rules.

The mosaic rule object has the following JSON syntax:

{
  "mosaicMethod" : "<esriMosaicNone | esriMosaicCenter | esriMosaicNadir | esriMosaicViewpoint | 
                     esriMosaicAttribute | esriMosaicLockRaster | esriMosaicNorthwest | esriMosaicSeamline>",
  "where" : "<where>", //Use where clause to define a subset of rasters used in the mosaic, be aware that the rasters may not be visible at all scales
  "sortField" : "<sortFieldName>", //The field name used together with esriMosaicAttribute method
  "sortValue" : <sortValue>,//The base sort value used together with esriMosaicAttribute method and sortField parameter
  "ascending" : <true | false>, //Indicate whether to use ascending or descending order.
  "lockRasterIds" : [<rasterId1>, <rasterId2>],//Lock a few rasters in the image service. Used together with esriMosaicLockRaster.
			These rasters are forced to be visible at all scales. Be aware of the maxMosaicImageCount limit of the service.
  "viewpoint" : <point>,//Use a view point along with esriMosaicViewpoint. 
  "fids" : [<fid1>, <fid2>], //use the raster id list to define a subset of rasters used in the mosaic, be aware that the rasters may not be visible at all scales.
  "mosaicOperation" : "<MT_FIRST | MT_LAST | MT_MIN | MT_MAX | MT_MEAN | MT_BLEND | MT_SUM>"//Use the mosaic operation to resolve overlap pixel values: from first or last raster, use the min, max or mean of the pixel values, or blend them.
  "itemRenderingRule":<renderingRule>//optional. new at 10.2. the rendering rule applies on items before mosaicking.
  "multidimensionalDefinition":[<dimensionalDefinition1>,<dimensionalDefinition2>...] //optional. new at 10.3. filtering by variable/dimensions
  "time":<timeInstant |time extent>//optional. New at 10.9. The time instant or time extent of the raster to be mosaicked.
}

The image service has a list of allowed mosaic methods: None, Center, NorthWest, Nadir, Viewpoint, ByAttribute, LockRaster, and Seamline. They correspond to the following mosaicMethod enums:

  • None—esriMosaicNone
  • Center—esriMosaicCenter
  • NorthWest—esriMosaicNorthwest
  • Nadir: esriMosaicNadir
  • Viewpoint—esriMosaicViewpoint
  • ByAttribute—esriMosaicAttribute
  • LockRaster—esriMosaicLockRaster
  • Seamline—esriMosaicSeamline

New at 10.2: mosaic operation "MT_SUM" is supported.

New at 10.2: mosaic rules can take an optional item rendering rule. See Raster Function Json Objects for the syntax and examples.

New at 10.3: mosaic rules can take an optional multidimensional definiton to filter variables/dimensions. Refer to Multidimensional Definition for the syntax and examples.

The following are the parameters associated with each mosaic method:

None

Orders rasters based on the order (ObjectID) in the mosaic dataset attribute table. Mosaic results are view-independent.

{
  "mosaicMethod" : "esriMosaicNone", //required
  "where" : "<where>", //optional
  "ascending" : <true | false>,//optional, default is true
  "fids" : [<fid1>, <fid2>],//optional
  "mosaicOperation" : "<MT_FIRST | MT_LAST | MT_MIN | MT_MAX | MT_MEAN | MT_BLEND | MT_SUM>" //default is MT_FIRST
}

Example:

{
  "mosaicMethod" : "esriMosaicNone",
  "ascending" : true,
  "fids":[1,2,3],
  "mosaicOperation" : "MT_FIRST"
}

Center

Orders rasters based on the distance between their centers and the view center. Mosaic results are view-dependent.

{
  "mosaicMethod" : "esriMosaicCenter", //required
  "where" : "<where>", //optional
  "ascending" : <true | false>,//optional, default is true
  "fids" : [<fid1>, <fid2>],//optional
  "mosaicOperation" : "<MT_FIRST | MT_LAST | MT_MIN | MT_MAX | MT_MEAN | MT_BLEND | MT_SUM>" //default is MT_FIRST
}

Example:

{
  "mosaicMethod" : "esriMosaicCenter",
  "ascending" : true,
  "mosaicOperation" : "MT_FIRST",
  "where":"ImageType='Landsat7'"
}

NorthWest

Orders rasters based on the distance between their centers and the northwest point of the service. Mosaic results are view-independent.

{
  "mosaicMethod" : "esriMosaicNorthwest", //required
  "where" : "<where>", //optional
  "ascending" : <true | false>,//optional, default is true
  "fids" : [<fid1>, <fid2>],//optional
  "mosaicOperation" : "<MT_FIRST | MT_LAST | MT_MIN | MT_MAX | MT_MEAN | MT_BLEND | MT_SUM>" //default is MT_FIRST
}

Example:

{
  "mosaicMethod" : "esriMosaicNorthwest",
  "ascending" : true,
  "mosaicOperation" : "MT_FIRST"
}

Nadir

Orders rasters based on the distance between their nadir position and view center. Mosaic results are view-dependent.

{
  "mosaicMethod" : "esriMosaicNadir", //required
  "where" : "<where>", //optional
  "ascending" : <true | false>,//optional, default is true
  "fids" : [<fid1>, <fid2>],//optional
  "mosaicOperation" : "<MT_FIRST | MT_LAST | MT_MIN | MT_MAX | MT_MEAN | MT_BLEND | MT_SUM>" //default is MT_FIRST
}

Example:

{
  "mosaicMethod" : "esriMosaicNadir",
  "ascending" : true,
  "mosaicOperation" : "MT_FIRST"
}

Viewpoint

Orders rasters based on the distance between their centers and a user defined view point. Mosaic results are view-independent.

{
  "mosaicMethod" : "esriMosaicViewpoint", //required
  "viewpoint" : <point>,//required
  "where" : "<where>", //optional
  "ascending" : <true | false>,//optional, default is true
  "fids" : [<fid1>, <fid2>],//optional
  "mosaicOperation" : "<MT_FIRST | MT_LAST | MT_MIN | MT_MAX | MT_MEAN | MT_BLEND | MT_SUM>" //default is MT_FIRST
}

Example:

{
  "mosaicMethod" : "esriMosaicViewpoint",
  "ascending" : true,
  "viewpoint":{"x":100,"y":90,"spatialReference":{"wkid":4326}},
  "mosaicOperation" : "MT_FIRST"
}

ByAttribute

Orders rasters based on the absolute distance between their values of an attribute and a base value. Only numeric or date fields are applicable. Mosaic results are view-independent.

{
  "mosaicMethod" : "esriMosaicAttribute", //required
  "sortField" : "<sortFieldName>",//required, numeric or date fields only.
  "sortValue" : <sortValue>,//optional, default is null or 0. Use numeric values for numeric fields and use the following string format for date field:
								yyyy/MM/dd HH:mm:ss.s
								yyyy/MM/dd HH:mm:ss
								yyyy/MM/dd HH:mm
								yyyy/MM/dd HH
								yyyy/MM/dd
								yyyy/MM
								yyyy
							
  "ascending" : <true | false>,//optional, default is true
  "where" : "<where>", //optional  
  "fids" : [<fid1>, <fid2>],//optional
  "mosaicOperation" : "<MT_FIRST | MT_BLEND | MT_SUM>" //default is MT_FIRST
}

Example:

{
  "mosaicMethod" : "esriMosaicAttribute",
  "sortField": "acquisitionDate",
  "sortValue":"2010/12/31",
  "ascending" : true,
  "mosaicOperation" : "MT_FIRST"
}

LockRaster

Displays only the selected rasters. Mosaic results are view-independent.

{
  "mosaicMethod" : "esriMosaicLockRaster", //required
  "lockRasterIds" : [<rasterId1>, <rasterId2>],  //required
  "where" : "<where>", //optional
  "ascending" : <true | false>,//optional, default is true
  "fids" : [<fid1>, <fid2>],//optional
  "mosaicOperation" : "<MT_FIRST | MT_LAST | MT_MIN | MT_MAX | MT_MEAN | MT_BLEND | MT_SUM>" //default is MT_FIRST
}

Example:

{
  "mosaicMethod" : "esriMosaicLockRaster",
  "lockRasterIds": [1,2,3],
  "ascending" : true,
  "mosaicOperation" : "MT_FIRST"
}

Seamline

Orders rasters based on the predefined seamline. The ascending property is defined by the seamline so is not applicable anymore. Only two mosaic operations are applicable as listed below. Mosaic results are view-independent.

{
  "mosaicMethod" : "esriMosaicSeamline", //required
  "where" : "<where>", //optional  
  "fids" : [<fid1>, <fid2>],//optional
  "mosaicOperation" : "<MT_FIRST | MT_BLEND>" //default is MT_FIRST
}

Example:

{
  "mosaicMethod" : "esriMosaicSeamline",
  "mosaicOperation" : "MT_BLEND"
}