Overview
This topic discusses the JSON representation of mosaic rule objects. 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. The rendering rule applies on items before mosaicking.
"multidimensionalDefinition":[<dimensionalDefinition1>,<dimensionalDefinition2>...] //optional. filtering by variable/dimensions
"time":<timeInstant |time extent>//optional. The time instant or time extent of the raster to be mosaicked.
}
Allowed mosaic methods
The image service has a list of allowed mosaic methods:
esri
Mosaic None esri
Mosaic Center esri
Mosaic Northwest esri
Mosaic Nadir esri
Mosaic Viewpoint esri
Mosaic Attribute esri
Mosaic Lock Raster esri
Mosaic Seamline
None
Orders images 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
}
Center
Orders rasters based on the distance between their centers and the view center. Mosaic results are view-dependent.
{
"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
}
NorthWest
Orders images 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
}
Nadir
Orders images 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
}
Viewpoint
Orders the image with its nadir position closest to the user-defined viewpoint on top. 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
}
ByAttribute
Orders images 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
}
LockRaster
Displays only the selected images. 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
}
Seamline
Orders images 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
}