Example: Create a Bounding Box for Building Footprints with Merge

We would like to create a rectangular area that covers our area of interest, a region for which we have building footprints, that we can use to clip other data. In this example, we  import a shapefile containing building footprints, and then we use the Merge template to create a rectangle that is the bounding box for all building footprints.   

 

Screen shots in this topic show undocked windows and panes to allow greater room for illustrations.  Undock or dock a window by Shift-clicking on its name tab or name caption bar.  Undocked windows and panes can be resized as desired.

Import a Shapefile

We launch Manifold and then in the main menu choose File - Import.

 

 

We navigate to the location of our desired shapefile and then we double-click the file ending in .shp, in this case, the buildings.shp file.

 

 

A new drawing and its table appear in the Project pane.  We double-click the buildings drawing to open it in a window.

 

 

The drawing opens in default gray formatting.  In the illustration above, we have used the Style pane to apply a thematic format using the mfd_id field to color the various building footprints in shades of brown.   We do not have to do that, but it looks cool, better than drab gray formatting.

Create a Rectangle

With the focus on the open buildings window, in the Transform pane we choose the Geom field and then we double-click the Merge template to launch it.

 

 

In the Merge template we choose the rectangle operation as the Merge into option.  We leave the Group option at the default (no field) setting, which will merge all polygonal areas in the drawing into a single rectangular area.    There are many options in the Merge into option, such as convex hull or rectangle with rotation, if we prefer, but for this example we will just use rectangle.

 

For the Result destination, we choose New Table and specify rectangle for the name of the new drawing and an analogous name for the new table.   We can specify whatever names we want, but it makes sense to use names that will remind us of what the new drawing and table contain.

 

Press Transform.

 

 

A new rectangle drawing and its table appears in the Project pane.  We drag and drop the new rectangle drawing as a layer into the open buildings window.    

 

 

The rectangle appears in default gray formatting.   We can create a more interesting display using the Layers pane.

 

 

In the Layers pane we change the opacity of the rectangle layer to 50%.

 

 

Much better.  With reduced opacity in the upper layer we can see how the rectangle that was created is the minimum enclosing rectangle for all of the building footprint polygons.

Export the Result

Suppose we would like to export the result out to a shapefile?  That is easy.

 

 

In the Project pane, right-click on the rectangle drawing and choose Export.

 

 

The system remembers that the most recently used format for import/export was SHP files, so that will loaded by default in the Save as type box.  We can choose a different format from the pull down list for that box if desired.  

 

Navigate to the destination folder desired and press Export.   Manifold will create the ensemble of files for the rectangle.shp files, including a .prj to capture full projection information.   The rectangle drawing inherited the same coordinate system used by the buildings layer, so the coordinate system in the resulting exported shapefile will be the same as well.

Just for Fun - A Convex Hull

The Transform pane still is loaded with all settings used to create the rectangle drawing.  If we would like to create a convex hull that encloses the building footprints, we can do that with a few simple adjustments, and then re-running the Merge template.

 

 

In the Merge template within the Transform pane, from the pull down menu of options for the Merge into box we choose convex hull.

 

In the New drawing and New table boxes, we enter the name convex hull for the drawing and a corresponding name for the table.

 

Press Transform.

 

 

A new convex hull drawing and table appear in the Project pane.

 

 

We drag and drop the convex hull drawing into the open buildings window.  In the illustration above, we have double-clicked the rectangle layer tab to turn that layer off, and we have used the Layers pane to set the opacity of the convex hull layer to 50%.

See Also

Selection

 

Transform Pane

 

Transform Reference

 

Transform - Geometry: Merge

 

Topology Overlays

 

Example: Two Drawings from the Same Table - Take a table with a geom field that is visualized by a drawing.  Add a second geom field to the table and create an rtree index on that field so it can be visualized by a drawing.   Copy the first drawing, paste it and adjust the pasted copy so it uses the second geom field.

 

Example: Copy one Column into Another Column with Transform - How to use the Transform pane to copy the contents of one column in a table into another column, but only for selected records.  Uses the Products table from the Nwind example data set.  

 

Example: Transform Field Values using an Expression in the Transform Pane - How the Expressions tab of the Transform pane may be used to change the values of fields.  

 

SQL Example: Learn SQL from Edit Query - Merging Areas - We learn how to write an SQL query that does a Merge : area (dissolve) operation by cutting and pasting from what the Edit Query button automatically generates.

 

Example: Construct JSON String using Select and Transform - Use the Select pane and the Transform pane to manually construct a JSON string using values from other fields in a table. Shows how we can manipulate text to build desired contents in a field.

 

Example: Edit a Drawing with Transform Templates - In this example we open a drawing and edit objects in the drawing using Transform pane templates.  Includes examples of saving results to a new component and also the Edit Query button.

 

Example: Use a Transform Expression to Create Buffers in a Drawing - Use the Expression tab of the Transform pane to create three different sizes of buffers for different lines in a drawing and then automatically create a query which does the same thing.  Includes examples of saving results to a new component and also the Edit Query button.

 

Example: Clip Areas with a Transform Expression - Use the Expression tab of the Transform pane to clip areas in a drawing to fit within horizontal bounds.   Includes examples of saving results to a new component and also the Edit Query button.

 

Example: Simplify Lines with a Transform Expression - Use the Expression template in the Transform pane to make lines smoother in a drawing so that longer lines are smoothed more.  Includes examples of using the Edit Query button to show how different queries are created automatically depending on if we want to update a field or to add a new component.

 

Example: Merge : areas (dissolve) - In this example we combine multiple area objects into a single area object by using the Merge template in the Transform pane, using the areas (dissolve) option.  A drawing of French regions shows some regions as more than one area.  We would like each region to be one area so the table of regions has one record per region.