Glue raster maps
Functionality
The Glue raster maps operation glues or merges two or more georeferenced input raster maps into one output raster map. The output map then comprises the total area of all input maps. The domains of the input maps are merged when needed. With the Glue raster maps operation, you can thus merge two or more adjacent or partly overlapping raster maps (i.e. make a mosaic) or glue smaller raster maps onto a larger one.
When the input raster maps have attribute tables, also the tables will be automatically merged; for more information see the Glue tables operation.
Input maps: In the dialog box, you can select 2, 3, or 4 input raster maps. On the command line, you can specify as many input maps as you like. The input maps may be purely adjacent to one another, partly overlapping, or totally overlapping. When the input maps are (partly) overlapping, the input maps form a pile of maps on top of each other.
Map on top: When the pile of input maps are (partly) overlapping the same area, you have to decide which map should be considered as the map on top. When for a pixel a value is found in the map on top, that value will appear in the output map. When the undefined value is found in the map on top, the operation will look in the map 'below' it. Undefined pixels thus act as being transparent and provide 'openings' to enable the operation to find a value in the map below the current one.
In the dialog box, you can select the check box 'Last Map on Top' to order the input maps as:
- the map which was selected last, to appear on top,
- the map selected one but last, below that one,
- until the map selected first.
On the command line, you can use the Replace option to this end.
Then, for each pixel, the operation will do:
- when a value is encountered in the map you selected last: that value will appear in the output map;
- when the undefined value is encountered in the map you selected last: the operation will look in the map that was selected one but last;
- when a value is encountered in the map you selected one but last: that value will appear in the output map;
- when the undefined value is encountered in the map you selected one but last: the operation will look in the map that was selected second but last, etc.
Only when no value is found at all, the output pixel will be assigned the undefined value. Mind: when the output map uses the Image domain, this means value 0; when the output map uses a Picture domain or the Color domain, this means color (0,0,0), i.e. black.
Output georeference / First input map:
If you wish, you can specify to use an existing georeference for the output map (both dialog box and command line), or you can create a new georeference corners yourself for the output map (dialog box only). Tip: When you choose an existing georeference corners or create a new georeference corners, then the output map will always be North-oriented.
When no existing georeference is specified, and when you did not create a georeference yourself, the system will, if required, automatically construct a georeference for the output map; it will be sized in such a way that all input raster maps will fit in the new georeference.
- This output georeference will be based on the first input map; the georeference of the first input map will directly determine the pixel size and the coordinate system for the output georeference.
- Furthermore, this type of output georeference will automatically obtain the same name as the output raster map; the output georeference created by the system is a georeference of type submap.
See also the section Georeference of output map below.
Domain combinations: You can always merge maps that use the same domain, and maps that use domains of the same type. In some cases, you can also merge maps of different domain types. The list below shows the possible combinations of input domain types and also shows the output domain type.
In
|
In
|
Out
|
Image
|
Image
|
Image
|
Image
|
Value
|
Value
|
Image
|
Color
|
Color
|
Value
|
Value
|
Value
|
Value
|
Color
|
Color
|
Class
|
Image
|
Color
|
Class
|
Value
|
Color
|
Class
|
Class
|
Class
|
Class
|
Color
|
Color
|
ID
|
ID
|
ID
|
Picture
|
Picture
|
Picture
|
Picture
|
Color
|
Color
|
Color
|
Color
|
Color
|
Bool
|
Bool
|
Bool
|
Bit
|
Bool
|
Bool
|
Bit
|
Bit
|
Bit
|
For more information, see also the section Domain of output map below.
Example:
To show a certain landuse type (of a class map) on a satellite image:
- Select an image that you want to use as background and stretch the image with the Stretch operation.
- To obtain for instance a landuse map showing only agricultural units, perform MapCalc statements like:
|
Agri
|
=
|
iff ((landuse="agriculture") or (landuse="agriculture (irrigated)"), landuse, "?")
|
Explanation: if map landuse is classified as agriculture, then have these classes remain, else assign undefined.
- Use the Glue Raster Maps operation to merge the map Agri with your stretched image. The results may look like below.
- The result of the Glue Raster Map operation is shown in Figure 1 below.
Fig. 1: Agricultural land use over a satellite image. The light green part is agriculture with irrigation, the dark green part is rainfed agriculture.
For presentation and printing purposes, you could of course also use the Mask Polygons operation, use as mask agri* . Then, display the output polygon map on top of the satellite image in a map window.
Input map requirements:
The domains of the input maps should be mergeable, see the list of domain combinations above.
All input raster maps must have a georeference, which is not georeference None.
Domain of output map:
The domain type for the output map can be found in the list of domain combinations above. Here some extra information will be given on how the system deals with the domains for the output maps.
- The output map will use system domain Image when you are combining images with each other.
- The output map will use system domain Value when you are combining value maps with value maps or images with value maps. The value range for the output map is determined by the smallest minimum and the largest maximum of all input maps; the precision is the smallest precision of the input maps.
- The output map will use a class domain when all input maps use a class domain. When all input maps use the same class domain, then the output map will also use this class domain. When the input maps use different class domains and when the class names in the input domains are different, then all class names of all input domains will be merged automatically into a new output domain. You can choose whether the new domain should be stored as a separate object, or whether it should be stored by the output map (internal domain). Also the representations of the input class domains will be merged into a new output representation; the new representation is either stored as a separate object or by the output map (internal representation).
- The output map will use an ID domain when all input maps use an ID domain. The same procedure is followed as for class maps. There are no representations involved.
- The output map will use a Picture domain when all input maps use a Picture domain. When all input maps use the same Picture domain, the output map will also use this Picture domain. When the input maps use different Picture domains and when the colors in the input Picture domains are different, then the colors of all input domains will be merged automatically into a new output Picture domain. You have to keep in mind though that a Picture domain can only contain a maximum of 256 colors. Thus, when the total number of all input colors is 256 or less, the colors of the input pictures will be retained in the output picture. The new Picture domain will always be stored by the output map (internal domain) and not as a separate object.
- The output map will use system domain Color when you are combining images, value maps, class maps or pictures with a map that uses the Color domain, and when you are combining class maps with images or class maps with value maps. For class maps and pictures, the output colors will be retrieved from the representation of the input domains; for images and value maps, the output color will be retrieved from system representation Gray is used.
Georeference of output map:
- If all input maps use the same georeference, then that georeference will also be used for the output map.
- If you specified to use an existing georeference, or if you created a new georeference yourself in the dialog box, then that georeference will be used for the output map.
- When no existing georeference was used, and when no new georeference was created by the user, and when the input maps use different georeferences, then the system will automatically create a new georeference (type submap) for the output map.
This new georeference submap, created by the system, will always use the pixel size and coordinate system of your first input map; the size of this georeference will be such that all input maps fit in it; the name of this new georeference will be the same as the name of output map.
If necessary, all input maps are resampled with the Nearest Neighbour method to the output georeference.
Usually, the input georeferences will use the same coordinate system which covers the whole area already. In case input georeferences use different but compatible coordinate systems (e.g. different projections), the coordinate system of the first input map is used for the output georef, and a coordinate transformation is performed for the other input maps.
Tips:
- When input maps are resampled to a new output georeference, this will be done with the Nearest Neighbour method. When working with value maps which use different georeferences, and when you would like to calculate with the output value map of the Glue Raster maps operation, you will obtain better interpolation results from the Glue Raster maps operation, when:
- you first make one new large georeference,
- resample your maps to this new georeference by using the Resample operation with the Bilinear or BiCubic interpolation method, and
- only when all maps use the same new large georeference, use the Glue Raster Maps operation.
- When you wish to combine class maps with ID maps, you first have to convert either the class domain into an ID domain or the ID domain into a class domain. In fact, it is quite easy to convert Class and ID domain(s) to each other: open the Domain Properties dialog box of the domain that you want to convert, and click the Convert to Classes or the Convert to IDs button. When converting IDs to classes, you can create a representation class for your map; when converting from classes to IDs, you will loose your representation class.
- When you wish to combine a class map with one image, it is advised to first stretch the image; this will improve the contrast in the output map with the Color domain.
- When you wish to combine a class map with multiple images, it is advised to first use the glue raster maps operation only with all images, then stretch the output image and finally use the glue raster maps operation again to merge the class map in it. This will improve the contrast in the output map with the Color domain.
Note:
When merging class maps or ID maps, by default an internal domain is created for the output map to reduce the number of separately stored domains. Internal domains are stored by an output map. If you like, you can select the New Domain check box in the dialog box and specify a new name for the output domain if you want the output domain to be stored as a separate object.
For more information on internal domains and representations, refer to How to open internal domains/representations.
See also:
Glue raster maps : dialog box
Glue raster maps : command line
Glue raster maps : algorithm
Resample : functionality
Resample : algorithm
Glue tables : functionality