Edit - Merge - Merge Drawings

This topic covers the Merge Drawings dialog used to combine multiple drawings into a single drawing.  

 

The Merge Dialog works with Maps

The Merge dialog works when a map window has the focus.   The dialog is used to merge layers within the map into a new layer.   The old layers are not deleted or altered: they are used as the sources for data that is merged to create a new layer of the specified name.

 

We can merge drawings that have been imported into the project, or drawings that have been linked into the project, or a mix of imported and linked drawings, to create a new, merged drawings.

 

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

 

 Merge several drawings into one drawing:

 

  1. Create a map.

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

  3. Choose Edit - Merge - Merge Drawings.

  4. Enter a Name for the new drawing if the default name "Drawing" is not desired.

  5. Double-click the on/off box to turn off for any drawing that is not to be merged.  

  6. Choose the desired coordinate system using the coordinate system picker button, or, right-click onto one of the drawings that is to be merged, and choose Use Coordinate System to use the coordinate system of that drawing.

  7. Press Merge.  A new drawing and table will be created in the project that combines all the merged drawings into one drawing.  

 

In the very simple case where a map contains as layers only those drawings that are to be merged, the default coordinate system will automatically be set to that used by one of the merged drawings.  If all of the drawings use the same coordinate system, that is a good choice.   In that simple case, we do not need to do step 6 above.    

 

If different drawings to be merged use different coordinate systems, it is good to get into the habit of right-clicking a drawing to be merged and choosing Use Coordinate System.   That way, we specify what coordinate system is desired, in case some of the drawings to be used have very different coordinate systems.

 

See the Manifold 9 - Merge Drawings video for a step-by-step example using Merge Drawings.

 

 

The Merge dialog shows a list of all drawing layers in the map, allowing us to choose which will be merged.   Similar to how the Layers pane allows us to turn layers on and off, double-clicking on the box at right allows us to include or not include a layer.     In the illustration above we do not want the first and the last drawing to participate in the merge, so we have double-clicked them off.

 

The illustration above also shows that, of the three layers which will participate in the merge, two of the layers will be re-projected from some other coordinate system into the Pseudo-Mercator projection used by the map and which will be used by the new, merged component.   One of the layers will not be re-projected, since the coordinate system matches Pseudo-Mercator.

 

Very Important:  The coordinate system used for the new drawing by default will be the coordinate system used by the map.    If we prefer a different coordinate system we can click on the coordinate system picker button for the Coord system setting and choose a different system.

 

A shortcut way to use a coordinate system that is used by one of the drawings in the list is to right-click onto the desired drawing and choose Use Coordinate System.  That will load the Coord system with that drawing's coordinate system.

Controls

The Merge dialog uses the same Manifold grid controls used in the Layers pane and in many other list dialogs.   

 

Name

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

Copy all fields

Copy values for all attribute fields into the new, merged drawing.  Unchecking this box creates a new, merged drawing with no attribute fields.

Save source component for each record

Add a new nvarchar type field called Source that contains the name of the layer from which objects were merged.  If we merge two layers, one called buildings and the other called roads, the resulting merged drawing will have a Source field that contains either the text value buildings or roads for each object that indicates the source layer from which that object was merged.  This is very useful when merging drawings where the name of the drawing is important in documenting the contents.  For example, if we have a series of drawings that give areas of various land use, and are named accordingly, such as forest, grassland, tundra, and so on, relying on the name of the drawing to document what the objects within are supposed to represent, creating the Source field for a merged drawing will automatically capture what type of land use that object is supposed to represent.

Skip records with null geometry

Do not merge any records that have null geometry, that is, which do not have any objects.

Coord system

The coordinate system to use for the new drawing.  By default, the coordinate system used by the map.  Change to whatever system is desired using the coordinate system picker button.   To choose  a coordinate system that is used by one of the drawings in the list, right-click onto the desired drawing and choose Use Coordinate System.

Coordinate system picker, launching the usual menus used to specify coordinate system.

Ctrl-click

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

   Move up

Move each selected layer up in the list.

 Move down

Move each selected layer down in the list.

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.

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.

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.

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.

 

Merging Linked Drawings

We can merge drawings that have been imported into the project, or drawings that have been linked into the project, or a mix of imported and linked drawings, to create a new, merged drawings.

 

We start with a project that has three vector drawings that are linked from shapefiles.   The data for the drawings remains in the original shapefiles: it has not been imported into storage within the project.   

 

 

The illustration above shows the three drawings as layers in a map, with a Bing streets image server as a background layer.   The three drawings show US Census Bureau tracts for the states of Pennsylvania, New York, and New Jersey.   

 

The drawings have been styled with different area fill colors for each drawing, and the Bing layer is shown with 50% opacity (set in the Layers pane), to provide a less visually intrusive background.

 

 

The illustration at left above shows the project pane with the three data sources that were created when we linked the shapefiles into the project.   All three shapefiles were downloaded from GIS data sites in the three sites for which they provide tracts, so they all use slightly different names, and all three use different coordinate systems.

 

For example, in the illustrations above the active layer in the map is the shapefile layer for census tracts in Pennsylvania.   We show the data source for that layer open, to show the drawing within the data source that we have dragged and dropped into the map.    Note that the Info pane shows the coordinate system for that layer as WGS_1984_Web_Mercator_Auxiliary_Sphere.

 

 

Clicking the New York and New Jersey layers in turn, we see that the New York layer uses the GCS_North_American_1983 coordinate system, and the New Jersey layer uses the NAD_1983_StatePlane_New_Jersey_FIPS_2900_Feet coordinate system.

 

To merge the three linked shapefiles into a single drawing within the project, with the focus on the open map window we choose Edit - Merge - Merge Drawings.

 

 

We enter a useful name for the resulting, merged drawing.   We uncheck the Save source component for each record box, since we do not want to add an extra field to the resulting drawing that gives the name of the original drawing for those records.

 

To specify the coordinate system of the resulting drawing, we have three choices:

 

 

For this example, we use the third option, pressing the coordinate picker button.

 

 

In resulting menu, we choose Latitude / Longitude, one of the default Favorites.    Press Merge Components to merge the three drawings into one.

 

 

A new drawing, called NJ NY PA census tracts, and the drawing's table appear in the Project pane.   Manifold has automatically imported the data from the three linked shapefiles, and then merged that imported data into a new drawing that is now stored within the project.  

 

 

We drag and drop the new NJ NY PA census tracts drawing into the map, and then Style it with a distinctive area fill color.  If we opened the drawing's table, we would see all fields from the three merged drawings appear in the table as well.

Tips for Working with Many, Large Layers

Manifold is very fast, so fast that usually we will not encounter delays when merging drawings.   However, if we want to merge many, large layers, such as 50 or 100 LiDAR point cloud layers, the time to render each layer that is added to a map can add up.   It can also take time to import many layers into the project.   

 

The following tips can make it easier to work with many large layers:

 

Example

We will merge 49 drawings imported from 49 shapefiles to form a single drawing.   The data sets are the GDT "Dynamap 1000" shapefiles giving all roads in the US in 1999 for the "lower 48" US states plus the District of Columbia.

 

See the 5 minute Tutorial - Parallel Rendering of Many Layers video for a video that shows the many layers used in this example in action, including the resulting merged layer.  The video shows how many layers can be rendered by Manifold very rapidly.

 

 

We have created a map in the project with a single layer, a Bing streets web server background layer.  

 

Before importing the shapefiles, we create a folder to better organize the 49 drawings that will be created by the import.   Clicking the folder to highlight it, we choose File - Import.

 

 

In the Import dialog, we navigate to the folder where our shapefiles are located.  In the Files of Type box we choose SHP Files (*.shp) to shown only the .shp files.   We Ctrl-click on the top .shp file in the list, and then we scroll down to the bottom of the list and Shift-Ctrl-click the bottom .shp file to pick all of the .shp files.   Press Import.

 

Import takes a while, since all files must be imported and fast indices built (the GDT data set did not have indices built for the shapefiles).  That is OK, as all that happens automatically while we do other work, grab coffee, or, if we have a really slow machine, get lunch.

 

 

After a while, 49 new drawings appear in the folder, the result of the shapefile imports.    

 

 

We Ctrl-click the top drawing to highlight it, and then we scroll down to the bottom of the list of drawings and Shift-Ctrl-click the last drawing in the list.  That will highlight both clicked drawings and all the drawings in between.

 

We open the map and then we can then drag and drop all 49 drawings at once into the map.

 

 

The 49 different layers start rendering.   Layer tabs seen with a blue underline are in the process of rendering.  Manifold renders so fast that even showing all of the roads in the Lower 48 states if we blink we will miss any blue underlines.   There are so many roads, that everywhere except very unpopulated areas they form a black mass.

 

If we were working with much larger data, though, we do not have to wait around for all the layers to render.  We can simply turn off all of the layers using the Layers pane.

 

 

With the focus on the open map window, in the Layers pane we scroll down to the bottom of the pane.  We Ctrl-click the Bing layer and the Background layer to select them, and then we press Ctrl-I on the keyboard to invert the selection. That ends up selecting only the 49 drawing layers.  

 

Another way to do the same thing is to click on any of the layers to move the keyboard focus into the pane, and then  Ctrl-A to select all layers.   We scroll to the bottom of the pane and Ctrl-click the Bing layer and the Background layer to deselect those.  

 

Once all of the 49 drawing layers are selected, we can click the visibility box for any of them and all of the selected layers will be turned off, since command actions like toggling the visibility box apply to all selected layers.

 

 

The layers turn off and any rendering in action stops, since Manifold will not waste time rendering layers that are turned off.    

 

We choose Edit - Merge - Merge Drawings to launch the Merge dialog.

 

 

Even though all of the drawing layers are turned off, they are still available in the Merge dialog and all are checked for use by default.    We enter a memorable  Name to use for the resulting, merged drawing.   We uncheck the Save source component for each record box since we do not care about recording what drawing was the source for each object.   We do check the Skip records with null geometry box, since there may be a few of those in the GDT data set.

 

Press Merge Components to launch the merge operation.

 

Manifold swings into action and starts merging.   On a faster machine with fast, latest generation M.2 SSD storage the merge will seem to go unexpectedly fast.  On a slower machine with conventional hard disk the merge may seem faster than expected based on prior experience with classic GIS packages, but it still may take ten or fifteen minutes.  

 

 

A new drawing, called US Roads, and associated table appear in the project.  In the illustration above we have reset the project filter button to show all types of components, and not only drawings.

 

 

Dragging and dropping the US Roads drawing into the map we see that there are so many roads they form a mass of black in most places.

 

 

We zoom far into Boston to see that all the roads are there.

 

Notes

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

 

Videos

5 minute Tutorial - Parallel Rendering of Many Layers - Shows the layers used in this example in action.

 

Manifold 9 - Merge Drawings

 

See Also

Drawings

 

Maps

 

Projections

 

Coordinate System

 

Layers Pane

 

Edit - Merge - Merge Images

 

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.

 

Merge