Edit - Merge - Merge Images

The Merge Images command is enabled when the focus is on a map window that contains image layers.   It creates a single, new image by combining image layers that appear in a map. The original image layers are not changed in any way.  With the focus on a map window, launch the command by choosing Edit - Merge - Merge Images.

 

Simple case: To merge several images into one image:

 

  1. Create a map.

  2. Drag and drop the images to be merged into the map.

  3. If any of the images overlap, order the layers so the preferred images are on top.

  4. Choose Edit - Merge - Merge Images.

  5. Provide a Name for the new image if the default name "Image" is not desired.

  6. Press Merge Components.  A new image and tile table will be created in the project that combines all the merged images into one image.  

 

The above is the simple case where the map contains as layers only those images that are to be merged, so the default coordinate system will automatically be set to that used by one of the merged images, almost always a good choice.  

 

We can also merge images in a more complex map that includes layers in addition to the images being merged.   For example, a map may contain image layers that are web server image layers that appear above or below the image layers that are to be merged.

 

Complex case: To merge several images into one image:

 

  1. Create a map.

  2. Drag and drop the images to be merged into the map.

  3. If any of the images overlap, order the layers so the preferred images are on top.

  4. Choose Edit - Merge - Merge Images.

  5. Provide a Name for the new image if the default name "Image" is not desired.

  6. Double-click the on/off box to off for any image that is not to be merged.  

  7. Right-click onto one of the images that is to be merged, and choose Use Coordinate System.

  8. Press Merge Components.  A new image and tile table will be created in the project that combines all the merged images into one image.  

 

 

See the Example: Merge Images  topic for a detailed, step-by-step example.   See the Manifold 9 - Merge Images video for a video version of the example.

 

dlg_merge_images.png

 

The Merge dialog shows a list of all image layers in the map, allowing us to choose which will be merged.  Similar to how the Layers panel allows us to turn layers on and off, double-clicking on the box at right allows us to include or not include a layer.  The dialog automatically un-checks layers for big images on web data sources like Bing or Google. 

 

In the illustration above we have already right-clicked one of the images to be merged and have chosen Use Coordinate System, to choose the coordinate system tech_ravi_sm.pngfor the coordinate system that will be used by the new, merged image.

 

Very Important:  The coordinate system used for the new image by default will be the same as the coordinate system used by the map.  If the map uses the same coordinate system as one of the images to be merged, we can accept the coordinate system offered by default as a reasonable choice.   If the map does not use the same coordinate system as one of the images to be merged, it is probably a mistake to use the coordinate system of the map.  Instead, we should right-click onto one of the images to be merged and choose Use Coordinate System.  That will specify a reasonable coordinate system to use.

 

For example, when we create a map based on a web server layer like Google or Bing, that map will be created with the same Pseudo-Mercator coordinate system used by that web server image, including all local scale values that make sense for that web server.  However, such values almost never make sense for other imagery.  

 

dlg_merge_images_wrong.png

 

The illustration above shows what the dialog looks like right after we choose Edit - Merge - Merge Images, and before we right-click one of the image layers and choose Use Coordinate System.   By default, the map uses the same Pseudo-Mercator system as Google, setting pixel size to about 7.5 cm per pixel, resulting in an image that is almost 12 million pixels wide, over 410 terabytes in size, a clear mistake that results from using the wrong local scale for pixel size (see Notes below).

Controls

The Merge dialog uses the same Manifold grid controls used in the Layers panel and in many other list dialogs.   Layer order may be important in case of overlaps.  When one layer overlaps another layer, the upper pixels will be used for the merge.

 

Name

Choose a name for the new image created by merging together image layers.

~0.00028 deg

Size of pixels to be created (Local scale X and Y values).  One value if both X and Y local scales are the same, otherwise two values will be shown.

28,801 x 14,401

Size of the image to be created in pixels.

Coord system

The coordinate system to use for the new, merged image.  By default, the coordinate system used by the map.  Change to whatever system is desired using the coordinate system picker button.   Set this to a good choice by right-clicking into one of the images to be merged in the list below and choosing Use Coordinate System.  

btn_coord_sys_picker.png

Coordinate system picker.   Choose the Edit Coordinate System in the menu to manually specify Local scale X and Local scale Y if required.

Ctrl-click

Ctrl-click onto a layer row to select that layer.

  icon_move_up.png Move up

Move each selected layer up in the list.

icon_move_down.png  Move down

Move each selected layer down in the list.

icon_move_top.png Move to Top

Move all selected layers to the top of the list, retaining their relative orders in a group at the top of the stack.

icon_move_bottom.png Move to Bottom

Move all selected layers to the bottom of the list,, retaining their relative orders in a group at the bottom of the stack.

icon_coord_sys.png

Coordinate system icon indicating how that layer will be re-projected to match the Coord system selected for the new component.  A red icon means that the coordinate system of a component is incomplete and will be treated as the default pseudo-Mercator. A black icon indicates that component data will be re-projected and that the re-projection will be curvilinear and lossy. A gray icon indicates that component data will be shifted, scaled or have axes swapped, resulting in a high accuracy transformation. No icon for vector data means that component data will not be transformed in any way. No icon for raster data means that component data might be at most shifted with the original pixel values kept intact.

icon_layer_off.pngicon_layer_on.png

Layer off (empty box) or on (filled box).  Double-click a layer name or the on/off box to toggle the layer off and on.  Applies

to all selected layers.   Layers that are off will not be used in the merge.

 

Coordinate Systems

It is critically important that we specify the coordinate system sensibly including the Local scale X and Local scale Y values used for the image.   Maps will often be created based on web server layers like Google or Bing, and thus will use the same Pseudo-Mercator coordinate system they use.   However, simply accepting Pseudo-Mercator as used by Google or some other web server is probably not correct.   The Local scale X and Local scale Y values set the pixel size for image.   Accepting whatever is used for a web server layer, or simply changing the coordinate system without adjusting the Local scale X and Local scale Y values to what they should be for the images in use, can result in wildly inappropriate values for the images we are merging.   That can cause the merged image to be hundreds of terabytes in size or otherwise unusable.   

 

ico_nb_arrow_blue.png Avoid such problems by right-clicking into one of the images to be merged and choosing Use Coordinate System.  That will specify for the new image exactly he same coordinate system already in use by the images that are being merged, almost always a safe choice.

Example

eg_merge_images_coordsys01_01.png

 

Consider the map above, which has a Google satellite web server layer as the bottom layer, with four SRTM3 terrain elevation image layers above it.  The uppermost layer is a Google streets web server layer where the pixels between streets are served by the Google web server as transparent pixels.   

 

The "transparent" Google streets layer is a great layer to use to show streets and location labels above our terrain elevation data, to provide context for what is seen in the terrain elevation data.  The map window uses Pseudo-Mercator projection, to allow display of labels as rendered by Google without distorting those labels by re-projecting them on the fly into a different projection.

 

To combine the four images into a single image we choose Edit - Merge - Merge Images.

 

eg_merge_images_coordsys01_02.png

 

However, when we launch Merge Images we see that the Coord system is taken from the map, which uses the same Pseudo-Mercator coordinate system as used by the Google layers.  The dialog indicates a really huge image will result, since the Pseudo-Mercator projection that uses scaling appropriate for Google is a bad choice for SRTM data.   

 

We can, if we like, create the new, merged Image using the Pseudo-Mercator system, but to do that we cannot just use the Pseudo-Mercator system with settings as used by Google because the Local scale X and Local scale Y values will be wrong.   We would have to adjust those local scale values in the Metrics dialog, to avoid creating a merged image that is many terabytes in size.  

 

To save ourselves from having to think about what the right values would be to use, we simply right-click onto one of the images to be merged and we choose Use Coordinate System.    

 

eg_merge_images_coordsys01_03.png

 

 

This will replace the Pseudo-Mercator coordinate system with the same coordinate system used by the images to be merged.     

 

Choosing Use Coordinate System tells the Merge dialog to use that coordinate system for the new Image that is to be created.  Since the images we are merging together already have Local scale X and Local scale Y values set to something that makes sense (or else they would not have appeared OK in the map), when we use the coordinate system from one of those images we automatically set the Local scale X and Local scale Y values for the new image that is created also to something sensible.  

 

eg_merge_images_coordsys01_04.png

 

In this case, we see it is the EPSG:4326 Latitude / Longitude coordinate system that SRTM data uses, with local scales set to 0.00028 degrees and a total image size that is no larger than the sum of sizes of the four images that are being merged together.     

 

The dialog has automatically un-checked the Google layers, knowing they are super-huge web server layers that are not likely layers we want to merge.    We can now press Merge Components to create a combined image.

 

The new Image will be created using EPSG:4326 Latitude / Longitude coordinate system with sensible settings.

 

Notes

Different Coordinate Systems - The Merge dialog will automatically handle different coordinate systems used by the images being merged.  

 

Different Numbers of Channels - The Merge dialog can merge images even when they have different numbers of channels.   The resulting image will have the largest number of channels found in any of the images being merged.  For example, if we have an image that uses four channels for RGBA which is merged with an image that only uses one channel the resulting merged image will have four channels.    This rule allows us the convenience of merging images with different numbers of channels but as a practical matter it means that palette images which depend upon using a single channel as an index into a palette will lose their coloring.  

 

Using Pseudo-Mercator with Corrected Scale Values -   As mentioned above, we could use the Metrics dialog to manually set Local scale X and Local scale Y values to something appropriate for the image data we are merging.    To do that, we click on the coordinate system picker button for Coord system and we drill down to setting a custom coordinate system, drilling down to the Coordinate System Metrics dialog.

 

eg_merge_images_coordsys01_05.png

 

The Pseudo-Mercator coordinate system as used by Google uses a local scale of X and Y just slightly above 0.07 meter per pixel in X and Y directions.   

 

eg_merge_images_coordsys01_06.png

 

We change that to using 40 meters per pixel in X and Y directions.  We also set 0 for the local offsets and then press OK back up through the dialogs to the Merge dialog.

 

eg_merge_images_coordsys01_07.png

 

The resulting custom system, which we have named custom pseudo merc, is a Pseudo-Mercator system like that Google uses but with local scaling and offsets that are a better match to the SRTM data we use.   As we can see, using pixels that are 40 meters square results in created image size about that which would be created by using the coordinate system of one of the merged images.

 

Videos

Manifold 9 - Merge Images  - Manifold makes it easy to combine rasters like images and terrain elevation data from many different files or layers into a single layer or data set.  The new Merge dialog will automatically deal with overlaps, different coordinate systems and similar real world complications.  This video shows how to merge step by step, and then colors the result with a palette and applies hill shading.

 

See Also

Images

 

Maps

 

Projections

 

Coordinate System

 

Contents - Layers

 

Edit - Merge - Merge Drawings

 

Example: Merge Images - A step-by-step example using the Merge Images command showing how to merge dozens of images showing SRTM terrain elevation data into one image, with various tricks for faster workflow as an experienced Manifold user would do the job.  After creating the new image we style it with a palette and use hill shading to better show terrain elevation.